title: Controlling component from backing bean
body: <p>I want to 'update' a component with a new component in the bean.</p>
  
  <p><strong>XHTML</strong></p>
  
  <pre><code>&lt;composite:interface&gt;
    &lt;composite:attribute name="rootKey"   required="true" /&gt;
    &lt;composite:attribute name="id"        required="true" /&gt;
  &lt;/composite:interface&gt;
  &lt;composite:implementation&gt;
  
  &lt;rich:panel id="#{cc.attrs.id}" binding="#{myBean.customPanel}"/&gt;
  
  &lt;a4j:jsFunction name="createPanels"
    action="#{myBean.createPanels}"
    render="#{cc.attrs.id}"&gt;
    &lt;a4j:param name="rootId" assignTo="#{myBean.rootId}"/&gt;
    &lt;a4j:param name="rootKey" assignTo="#{myBean.rootKey}"/&gt;
  &lt;/a4j:jsFunction&gt;
  
  &lt;script type="text/javascript"&gt;
  /* &lt;![CDATA[ */
    jQuery(document).ready(function() {
      createPanels('#{cc.attrs.id}','#{cc.attrs.rootKey}');
    });
  /*]]&gt;  */
  &lt;/script&gt;
  &lt;/composite:implementation&gt;
  &lt;/ui:composition&gt;
  </code></pre>
  
  <p><strong>Bean</strong></p>
  
  <pre><code>private UIPanel rootPanel;
  
  public void setCustomPanel(UIPanel panel) {
    rootPanel = panel;
  }
  
  public UIPanel getCustomPanel() {
    return rootPanel;
  }
  
  public void createPanels() {
    //try #1 : Adding new panels as children
    rootPanel.getChildren().add((UIPanel)createPanels(rootId,rootKey));
    //try #2 : A new Panel component 
    rootPanel = (UIPanel)createPanels(rootId,rootKey); 
    ...
    rootPanel.setId(rootId); // this ID is the same as the 'placeholder' panelId 
    FacesContext.getCurrentInstance().getPartialViewContext().getRenderIds().add(rootPanel.getId()); // the rerender should also already be done in the XHTML js function.
  }
  </code></pre>
  
  <p>With the debugger i see the rootPanel changes into the new panel component, but not in the view. 
  What do i miss? </p>
  
  <p>What i try in short: Generating dynamically components as children for the panel component in the xhtml view. The generation needs the 'rootKey' param for generating the right set. </p>
  
  <p><strong>Using:</strong> </p>
  
  <ul>
  <li>JSF Mojarra 2.1.19</li>
  <li>Richfaces</li>
  </ul>