Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

UI - Bundling custom components.  RSS feed

 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is it possible to render multiple components within a single custom component? Say if I wanted to couple two inputboxes together...?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why would you need a custom component to render 2 components when you can just use a panelGroup or panelGrid and adjust it's rendered property accordingly?
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We're trying to prevent writing the same chunks of code a over and over again... Any thoughts?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jsp:include ?? Depends on the type of code you are wanting to include on more than one page. If it requires backing bean methods, consider putting these methods and properties in a bean that gets subclassed by other pages or just load that bean up in the session all by itself so that you can use it from wherever. You can use any number of backing beans on a single page.
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks man.
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Now, what if I wanted to have it only display after they pushed a button? and have the code belong to the form it's included within?
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Prene:
Now, what if I wanted to have it only display after they pushed a button? and have the code belong to the form it's included within?


Wrap it all up in a panelGroup component and change the panelGroup's rendered property accordingly. A panelGroup is basically a DIV. And you can't include code in the backing bean at runtime. I's got to already be there. So maybe this is a downside of JSF for what you are trying to do. The other obvious choice would be writing a custom component that you can throw on any page to encapsulate the funcationallity you need. Good luck with that as I know zip about writing custom components.
[ July 19, 2005: Message edited by: Gregg Bolinger ]
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Daniel Prene:
Is it possible to render multiple components within a single custom component? Say if I wanted to couple two inputboxes together...?


Yes. (Should I have just said that in the first place? )
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
panelGrid will work nicely. One last question though; how would I turn the render property on and off from else where? for example: using a listbox's onchange to hide and show forms.



Thank you for your help
 
Daniel Prene
Ranch Hand
Posts: 241
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
eerr panelGrids not forms... and I'm going to move this too a new post
[ July 19, 2005: Message edited by: Daniel Prene ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!