Panel update in PrimeFaces
<p>I'm having a issue in PrimeFaces panel update.</p>

<p>I have one main panel which contains two output panel. Each output panel may contains one button which is swap panel. The swap panel button is used to swap the output panel from one to another.</p>

<p>If I update the button action for render the panels I need to provide the main panel Id it works fine. But for a tree structure hierarchy, If I mean to give the two output panel Ids It doesn't render the panel. The Button action called only once when I put the log to confirm that.</p>

<p>I will attach my code samples given below:</p>

<p><strong>renderingPanel.XHTML</strong></p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:p="http://primefaces.org/ui"
      xmlns:ui="http://java.sun.com/jsf/facelets" 
      xmlns:c="http://java.sun.com/jsp/jstl/core"&gt;

    &lt;h:head&gt;
        &lt;title&gt;
           Panel Rendered
        &lt;/title&gt;
    &lt;/h:head&gt;
    &lt;h:body&gt;
        &lt;f:event listener="#{PanelRendered.initializePageAttributes}" type="preRenderComponent"/&gt;

        &lt;h:form id="panelFormId"&gt;
            &lt;p:panel id="mainPanelId" widgetVar="mainPanelId"&gt;
                &lt;p:outputPanel id="mainOutputPanel" rendered="#{PanelRendered.mainPanelRendered}"&gt;
                    &lt;h:outputText value="hello main"/&gt;
                    &lt;p:commandButton id="mainSwap" value="Swap To Sub Panel" update="mainOutputPanel,subOutputPanel" action="#{PanelRendered.mainButtonAction}" icon="ui-icon-transferthick-e-w"/&gt;
                &lt;/p:outputPanel&gt;

                &lt;p:outputPanel id="subOutputPanel" rendered="#{PanelRendered.subPanelRendered}"&gt;
                    &lt;h:outputText value="hello sub"/&gt;
                    &lt;p:commandButton id="subSwap" value="Swap To Main" update="subOutputPanel,mainOutputPanel"  action="#{PanelRendered.subButtonAction}" icon="ui-icon-transferthick-e-w"/&gt;
                &lt;/p:outputPanel&gt;

            &lt;/p:panel&gt;
        &lt;/h:form&gt;
    &lt;/h:body&gt;
&lt;/html&gt;
</code></pre>

<p><strong>PanelRendered.Java</strong></p>

<pre><code>public class PanelRendered
{

    private boolean mainPanelRendered;
    private boolean subPanelRendered;
    private Logger logger = Logger.getLogger(PanelRendered.class);

    public PanelRendered()
    {
         File configFile = new File("/home/nafeel/Applications/apache-tomcat-7.0.34/webapps/treetable/conf" + File.separator + "log4j.properties");
        if (configFile.exists())
        {
            PropertyConfigurator.configure(configFile.getAbsolutePath());
        }
        else
        {
            System.out.println("Configuration Logger File not available");
        }
    }

    public String mainButtonAction()
    {
        logger.info("Enter inside main button action");
        mainPanelRendered = false;
        subPanelRendered = true;
        return null;
    }

    public String subButtonAction()
    {
        logger.info("Enter inside sub button action");
        mainPanelRendered = true;
        subPanelRendered = false;
        return null;
    }

    public void initializePageAttributes()
    {
        logger.info("Enter inside initializepage");
        mainPanelRendered = true;
        subPanelRendered = false;
    }

    /**
     * @return the mainPanelRendered
     */
    public boolean isMainPanelRendered()
    {
        return mainPanelRendered;
    }

    /**
     * @param mainPanelRendered the mainPanelRendered to set
     */
    public void setMainPanelRendered(boolean mainPanelRendered)
    {
        this.mainPanelRendered = mainPanelRendered;
    }

    /**
     * @return the subPanelRendered
     */
    public boolean isSubPanelRendered()
    {
        return subPanelRendered;
    }

    /**
     * @param subPanelRendered the subPanelRendered to set
     */
    public void setSubPanelRendered(boolean subPanelRendered)
    {
        this.subPanelRendered = subPanelRendered;
    }
}
</code></pre>