title: How to refresh an included page passing a <ui:param> on selectOneMenu change?
body: <p>I am using Mojarra 2.2.11</p>
  
  <p>Starting from <a href="https://stackoverflow.com/questions/7108668/how-to-ajax-refresh-dynamic-include-content-by-navigation-menu">How to ajax-refresh dynamic include content by navigation menu?</a> with one leftMenu part (in one xhtml) and one content part where another xhtml <code>#{pageBean.page}</code> is included on the page: I want to update the content part where a list of Tabs are displayed versus the product selected in a selectOneMenu in the leftMenu part.</p>
  
  <p>With the help of <a href="https://stackoverflow.com/questions/4792862/how-to-include-another-xhtml-in-xhtml-using-jsf-2-0-facelets">How to include another XHTML in XHTML using JSF 2.0 Facelets?</a> I used <code>ui:param</code> (Not sure if appropriate). </p>
  
  <p>How can I use <code>ui:param</code> to pass the newly selected product stored in the sessionProduct(String) parameter before the Tabs in the content part is refreshed according to the product?</p>
  
  <p>(List of Tabs can be different depending on the product)</p>
  
  <p>content.xhtml:</p>
  
  <pre><code>&lt;ui:composition&gt;
      &lt;h:outputScript name="js/fixviewstate.js"  /&gt;
          &lt;div class="container-fluid"&gt;
              &lt;div class="row"&gt;
                  &lt;div class="col-sm-3 col-md-2 sidebar"&gt;    
                      &lt;ui:include src="leftMenu.xhtml" /&gt; 
                  &lt;/div&gt;
  
                  &lt;div id="target" class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main"&gt;                     
                    &lt;ui:insert name="content" /&gt;                      
  
                    &lt;ui:include src="/WEB-INF/includes/#{pageBean.page}.xhtml" &gt;
  
                         &lt;ui:param name="??" value="#{bean.product}" /&gt;
  
                    &lt;/ui:include&gt;  
  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>leftMenu.xhtml:</p>
  
  <pre><code>&lt;ui:composition&gt;
      &lt;h:form&gt;
              &lt;p:outputPanel style="float:center;margin-left: 33px"&gt; 
  
              &lt;h:selectOneMenu    value="#{bean.product}" onchange="submit();"
                          valueChangeListener="#{bean.init}"&gt;
  
                 &lt;f:selectItems value="#{bean.products}" /&gt;
  
              &lt;/h:selectOneMenu&gt;
  
            &lt;/p:outputPanel&gt;
      &lt;h:form&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p>bean: </p>
  
  <pre><code>@ManagedBean
  @ViewScoped
  public class Bean implements Serializable{
  
  @EJB
  private PublicService publicService;
  
  private List&lt;Tab&gt; tabs;
  
  private List&lt;Product&gt; products;
  private Product product;
  
  ExternalContext externalContext = FacesContext.getCurrentInstance().getExternalContext();
  Map&lt;String, Object&gt; sessionMap = externalContext.getSessionMap(); 
  
  @PostConstruct  
  public void init(ValueChangeEvent event)  {
  
      String newValue = (String) event.getNewValue();
  
      sessionMap.remove("sessionProduct");
  
      sessionMap.put("sessionProduct", (String) event.getNewValue());  
  
      this.product = publicService.getSpecificProduct((String) event.getNewValue()); // returns Product Object
      this.tabs = publicService.getAllTabs();  // returns List&lt;Tab&gt; to be displayed in pageBean.page
  
  } 
  </code></pre>
  
  <p>Thank you for your time.</p>