This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes JSF and the fly likes creating JSF components at runtime Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Java » JSF
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: 48
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: 48
thanks solmaz!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: creating JSF components at runtime