3 Replies Latest reply on May 13, 2009 5:36 AM by ilya_shaikovsky

    Multiple tab panels and backing bean for each of them

    anandsaranath

      Hi,

      In my application, I have 3 top level tabs 'Jobs', 'Messages' and 'Audit. The 'Jobs' tab internally contains tabs like 'queue1', 'queue2'. These tabs are dynamically generated using c:forEach.

      The Messages tab has an associated MessagesBean backing bean and the Audit tab has an AuditBean backing bean.

      All the tabs have switchType as 'ajax'. When I switch between 'queue1' and 'queue2', I see in the log the MessagesBean and the AuditBean beans' constructors getting called. I am really puzzled. There is no reference to these beans from the bean associated to 'queue1' and 'queue2'.

      Why will the beans be instantiated when I have not even entered into the tabs associated to the beans?

      Any help here would be much appreciated.

      Regards
      Anand

        • 1. Re: Multiple tab panels and backing bean for each of them
          anandsaranath

          I forgot to mention that all the beans are request scoped.

          • 2. Re: Multiple tab panels and backing bean for each of them
            anandsaranath

             

            <rich:tabPanel switchType="ajax" selectedTab="#{SOV_ValueChangeListener.jobsTab}" valueChangeListener="#{SOV_ValueChangeListener.jobsTabValueChanged}">
             <c:forEach items="#{SOV_Queues.queueNames}" var="queue">
             <rich:tab label="#{queue}" switchType="ajax" id="queueTab_#{queue}">
             <a4j:support event="ontabenter" ajaxSingle="true" reRender="queue_#{queue}">
             <a4j:actionparam assignTo="#{SOV_SpecificQueueBean.queueName}" value="#{queue}" actionListener="#{SOV_SpecificQueueBean.queryJobs}"/>
             </a4j:support>
             <a4j:outputPanel id="queue_#{queue}">
             <ui:include src="/jsf/sov/queueJobs.xhtml"/>
             </a4j:outputPanel>
             </rich:tab>
             </c:forEach>
            </rich:tabPanel>
            


            In the above code, the tabs are dynamically generated. I changed the scope of the SpecificQueueBean from session to request. I am pre-fetching the intial tab's value from the backend and it gets displayed as part of the queueJobs.xhtml page. When I switch the tab, I also see the action listener fired. But, after the listener has completed its work, I see the Queues object getting constructed again and the SpecificQueueBean constructed again.

            I am not sure why the tab panel gets rendered again. Since I have an a4j:OutputPanel and have ajaxSingle as true in a4j:support attached to the rich:tab, shouldn't the output panel be the only one that should be re-rendered?

            I am confused.

            Please help!

            Regards
            Anand

            • 3. Re: Multiple tab panels and backing bean for each of them
              ilya_shaikovsky

              you could use limittolist attribuite in order to completelly limit the rendering of the components which tries to be automatically updated (should works with 3.3.1 codebase)