Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating JSF components at runtime

 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know this is possible... but how is it done?

Any links to tutorials or sample codes would be very helpful.
 
Solmaz Anvar
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks solmaz!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic