• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to use CommandLink in custom component?

 
yueming wu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everybody!

how can I render CommandLink in my component?



Any help would be great. Thanks.
 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do this:

Application application = FacesContext.getCurrentInstance().getApplication();
HtmlCommandButton b =(HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);
 
yueming wu
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by JP Estrada:
do this:

Application application = FacesContext.getCurrentInstance().getApplication();
HtmlCommandButton b =(HtmlCommandButton) application.createComponent(HtmlCommandButton.COMPONENT_TYPE);


How to render??.

b.encodeBegin(FacesContext.getCurrentInstance());
b.encodeEnd(FacesContext.getCurrentInstance());
???
 
JP Estrada
Ranch Hand
Posts: 48
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you create a panel grid in your jsp page:

<h:panelGrid columns="4" binding="#{BackingBean.component}" id="myGrid"/>

In your backing bean, create a UIComponent property with get/set methods.

To add your dynamic button to this component, do this:
component.getChildren().add(yourButton);
[ July 10, 2007: Message edited by: JP Estrada ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!