Built with Seam

You can find the full source code for this website in the Seam package in the directory /examples/wiki. It is licensed under the LGPL.

This is a simple example to illustrate how to populate a JSF main form from a rich:modalPanel action. The key is the reRendering of the main form and/or the form in the modalPanel, as required, and not reRendering too many UI components to improve performance. This is just a basic example so limiting regions using s:div, etc. will not be demonstrated. Remember that you can embed just about any RF/A4J component in a form in a modalPanel. I have embedded rich:dataTables in rich:modalPanels many times and those are the more common and more complicated scenarios, especially when you consider SMPC management.

For more info and examples, refer to Practical RichFaces by Max Katz as well as the RichFaces reference documentation.


<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 

<ui:composition xmlns=""
	<ui:define name="body">
		<h:form id="form1">
			<h:outputText value="The value is null." 
						  rendered="#{testPopup.myString eq null}"/>
			<h:outputText value="The value is #{testPopup.myString}"			 			  
			              rendered="#{testPopup.myString ne null}"/>	
			<h:outputLink value="#" id="link">
	        	Show modalPanel
		        <rich:componentControl for="modal1" attachTo="link" operation="show" event="onclick"/>
		<rich:modalPanel id="modal1" width="600" height="200">
	        <f:facet name="header">
	                <h:outputText value="Test Modal Panel"/>
        	<h:form id="form2">
        		<h:commandButton value="set String value" action="#{testPopup.setMyString('foo')}" reRender="form1"/>

TestPopup JavaBean component:

public class TestPopup implements Serializable {
	private String myString;
	public String getMyString() {
		return myString;

	public void setMyString(String myString) {
		this.myString = myString;