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 dynamic JSF components question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "dynamic JSF components question" Watch "dynamic JSF components question" New topic
Author

dynamic JSF components question

JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
Hi guys,

I can't seem to make my dynamic component appear on the page...

Here's the code in my backing bean:

UIComponent component;
/**
* @return Returns the component.
*/
public UIComponent getComponent() {
return component;
}
/**
* @param component The component to set.
*/
public void setComponent(UIComponent component) {
this.component = component;
}

public void populateComponent()
{
component = new UIPanel();
Application application = FacesContext.getCurrentInstance().getApplication();
UICommand output = (UICommand) application.createComponent(HtmlCommandLink.COMPONENT_TYPE);
output.setId("c2");
output.setValue("Test");

getComponent().getChildren().add(output);
}


public BackingBeanTest()
{
populateComponent();
}



Here's the code in my jsp page:
<f:view>
<h:form>
<BODY>
<h:panelGrid columns="4" binding="#{BackingBeanTest.component}" id="myGrid">
</h:panelGrid>
</BODY>
</h:form>
</f:view>


I dont get an error message. The component just doesn't appear on the page.. Help!
JP Estrada
Ranch Hand

Joined: Mar 21, 2006
Posts: 48
ok i got it...

I have to add an HtmlOutputText to my commandLink for the commandLink to appear:

link.getChildren().add(otext);

 
 
subject: dynamic JSF components question
 
Similar Threads
creating JSF components at runtime
dynamic panel grid binding
Problem with adding jsf component programmatically|dynamically
How to add new text boxes and check boxes dynamically when clicking on button in JSF
illegalArgumentException