| Author |
UI - Bundling custom components.
|
Daniel Prene
Ranch Hand
Joined: Jul 15, 2005
Posts: 241
|
|
|
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
Joined: Jul 11, 2001
Posts: 15230
|
|
|
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
Joined: Jul 15, 2005
Posts: 241
|
|
|
We're trying to prevent writing the same chunks of code a over and over again... Any thoughts?
|
 |
Gregg Bolinger
Ranch Hand
Joined: Jul 11, 2001
Posts: 15230
|
|
|
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
Joined: Jul 15, 2005
Posts: 241
|
|
|
Thanks man.
|
 |
Daniel Prene
Ranch Hand
Joined: Jul 15, 2005
Posts: 241
|
|
|
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
Joined: Jul 11, 2001
Posts: 15230
|
|
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
Joined: Jul 11, 2001
Posts: 15230
|
|
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
Joined: Jul 15, 2005
Posts: 241
|
|
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
Joined: Jul 15, 2005
Posts: 241
|
|
eerr panelGrids not forms... and I'm going to move this too a new post [ July 19, 2005: Message edited by: Daniel Prene ]
|
 |
 |
|
|
subject: UI - Bundling custom components.
|
|
|