This week's giveaways are in the MongoDB and Jobs Discussion forums.
We're giving away four copies of Mongo DB Applied Patterns and 4 resume reviews from Five Year Itch and have the authors/reps on-line!
See this thread and this one for details.
The moose likes JSF and the fly likes creating JSF components at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of Mongo DB Applied Patterns this week in the MongoDB forum
or a resume review from Five Year Itch in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » JSF
Reply Bookmark "creating JSF components at runtime" Watch "creating JSF components at runtime" New topic
Author

creating JSF components at runtime

JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 47
I know this is possible... but how is it done?

Any links to tutorials or sample codes would be very helpful.
Solmaz Anvar
Greenhorn

Joined: Jul 14, 2005
Posts: 26
Yes. It is possible to add components dynamically.
Create a container bean like this one:


public class ComplexBean
{
protected UIComponent component;
public ComplexBean()
{
component = new UIPanel();
}
public UIComponent getComponent()
{
return component;
}
public void setComponent(UIComponent component)
{
this.component = component;
}
}

Use component instance binding in your page, for
instance

<h anelGrid binding="#{ComplexBean.component}"/>

(The bean should be configured as a managed bean).

Now if you add components to your
ComplexBean.getComponent(), they will appear on the
page.

Regards
Solmaz
[ April 07, 2006: Message edited by: Solmaz Anvar ]

Solmaz Anvar
JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 47
thanks solmaz!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating JSF components at runtime