I have a requirement to show prime-faces form dynamically in a panel. The form contents shall come from database in form of xhtml having reference to actual managed beans as value expressions. I want to know how that form can be rendered on the panel dynamically.
Quick response or suggestions will be appreciated.
Dynamic display of xhtml form
I do what you need by creating all forms programmatically using the event PostAddToViewEvent which i found is the
only one is safe to change component tree.
In the listener I add and remove all components i need using the bean property mainPanel
like this:
The only bad thing is it's much harder to create forms programmatically than with tags.
I hope this helps.
only one is safe to change component tree.
Code: Select all
<h:panelGroup id="mainPanel" binding="#{mainbean.mainPanel}">
<f:event type="javax.faces.event.PostAddToViewEvent"
listener="#{mainbean.panelOnAddToView}"></f:event>
</h:panelGroup>
like this:
Code: Select all
mainPanel.getChildren().add( what you need to add )
I hope this helps.
-
- Information
-
Who is online
Users browsing this forum: No registered users and 32 guests