File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: creating JSF components at runtime