title: How to Display / Hide jsf components
body: <p>In one of my JSF application, I have header part at the top contains selectOneMenu, and the content part at the bottom which display say, Filter components. By default the application display first selectOneMenu data at the top and corresponding Filter information at the bottom. If the user selects different selectOneMenu data, corresponding Filter information should be loaded on bottom content part. </p>
  
  <p>Filter component has CommandButton and user fills Filter information. On click of the button, and the Filter is approved, the application should load another component - Report.xhtml in place of Filter component. That is Filter component should be replaced by Report on bottom content part. </p>
  
  <p>Click on selectOneMenu item should repeat the process. That is display Filter screen and so on.</p>
  
  <p>Problem area
  1. Not able to display Filter form and hide Report form on content part 
  2. Backing bean of Filter - commandButton OK should return value. Depending on outcome, Report should be displayed in place of Filter.</p>
  
  <p>I am not sure the design is accurate, if this is not going to work as intended, please suggest and your valuable answers will be appreciated. I would like to keep the application ajax based and I do not want to reload entire page on button event. </p>
  
  <p>GDK</p>
  
  <hr>
  
  <pre><code>&lt;h:form id="form1"&gt;    
  &lt;h:selectOneMenu value="#{states.stateName}"&gt;
    &lt;f:selectItems value="#{states.stateChoices}"/&gt;
    &lt;f:ajax render=":Filter"/&gt;
  &lt;/h:selectOneMenu&gt;
  &lt;/h:form&gt;
    &lt;h:form id="Filter"&gt;
        &lt;div id="content"&gt;            
         &lt;h:panelGroup id="one" rendered="Need a condition from form1 to display this"&gt;
              #{states.stateName}
              &lt;br/&gt;Report
              &lt;h:inputText id="report" value="#{Counties.report}" style="width:150px"/&gt;
              &lt;h:commandButton id="OK" value="OK" actionListener="#{Counties.getReports}"&gt;
              &lt;f:param name="CatName" value="Dekalb" /&gt;               
              &lt;/h:commandButton&gt;                 
          &lt;/h:panelGroup&gt;           
        &lt;/div&gt;
    &lt;/h:form&gt;
    &lt;h:form id="Report"&gt;
        &lt;div id="content"&gt;
          &lt;h:panelGroup id="two" rendered="#{should be rendered on acceptance from OK command button}"&gt;
               &lt;ui:include src="Report.xhtml"/&gt;
          &lt;/h:panelGroup&gt;
            &lt;/div&gt;
    &lt;/h:form&gt;
  </code></pre>