Sunday, November 25, 2012

Dynamic include with richfaces popupPanel

Scenario:
this post is to show how to dynamically include a page popupPanel when open, and remove the included page when closed.

The purpose to use dynamic include in popupPanel  are to avoid mandatory validation inside the popup, and to reduce the component tree size, thus reduce the network bandwidth.

Steps:
ManagedBean
1. create a placeholder in managedBean.
2. create a addIncludeUrl method in manageBean
3. create a hideIncludeUrl method in managedBean



xhtml
1. create a <a4j:jsFunction /> to invoke the addIncludeUrl method
2. create a <a4j:jsFunction /> to invoke the removeIncludeUrl method
3. create a content xhtml to be included in the popupPanel
4. create a popupPanel
5. create a <ui:include /> in the popupPanel to dynamically render the content xhtml

6. create a <a4j:commandButton /> or <a4j:commandLink /> to invoke the popupPanel

Done!

How to create wizard with dynamic include in JSF is another example on using dynamic include.

LinkWithin

Related Posts Plugin for WordPress, Blogger...