7 Replies Latest reply on Aug 14, 2009 6:08 PM by nbelaevski

    Performance Problem using rich:tabPanel.


      I am using rich:tabPanel to display my pages in my appplication.
      the user switches between tabs using AJAX request.

      I'll explain the issue with an example.

      Lets say there are 10 tabs in the tabPanel with each tab representing a different page.
      Now, Each page has its own bean and also the tabPanel has its own bean.
      Thus, there are in all 10+1 = 11 beans in the system.

      Now the problem is that if I click either of the tabs, all the 11 beans are called which really hampers the system speed because the user has wished to see only one tab but all the 10 tabs are being rendered and the tab I clicked is being displayed.

      My requirement is that I need only the bean relative to the tab clicked to be called at any time.

      Please Help.

        • 1. Re: Performance Problem using rich:tabPanel.

          Hi Akash,

          Please post tab panel code with all defined attributes.

          • 2. Re: Performance Problem using rich:tabPanel.

            Hi Nick,

            I did a bit of code digging and found the following:

            All the List objects belonging to extendeddatatables in a tabpanel are called.

            All my 10 pages were using rich:extendedDataTable and thus, the getter method corresponding to the object is called. If the page has not been initialized, then the constructor is also called for the page.
            Apart from this, the bean referring to the selected tab of the tabPanel will be called everytime.

            This means, the table List is being created even if the user has not clicked on the page tab.


            • 3. Re: Performance Problem using rich:tabPanel.

              Forgot to add,

              Only the getter method of the List object and the default constructor is called on the page and nothing else. No other method is called till the tab has not been clicked.

              • 4. Re: Performance Problem using rich:tabPanel.

                We had the same problem.
                The workaround is easy and elegant.
                Do your tab content as an include and only include it if its the currently selected tab.

                Here is an example.

                <rich:tabPanel switchType="ajax" selectedTab="#{companyWorksheet.currentTabName}">
                <rich:tab label="#{msg['label.collections']}" name="collections">
                <c:if test="${companyWorksheet.currentTabName eq 'collections' or empty companyWorksheet.currentTabName}">
                <ui:include src="/WEB-INF/includes/companyWorksheet/collectionsContainer.xhtml"/>

                <rich:tab label="#{msg['label.payments']}" name="payments">
                <c:if test="${companyWorksheet.currentTabName eq 'payments'}">
                <ui:include src="/WEB-INF/includes/companyWorksheet/paymentsContainer.xhtml"/>

                • 5. Re: Performance Problem using rich:tabPanel.

                  Hi Ryan,

                  thanks a lot for looking into,

                  I have used the following code,

                   <rich:tabPanel switchType="ajax" selectedTab="#{OverviewBean.selectedTab}">
                   <rich:tab label="Tab1" id="tab1" name="tab1">
                   <c:if test="#{OverviewBean.selectedTab eq 'tab1'}">
                   <ui:include src="../pages/tab1.xhtml" />
                   <rich:tab label="Tab2" id="tab2" name="tab2">
                   <c:if test="${OverviewBean.selectedTab eq 'tab2'}">
                   <ui:include src="../pages/tab2.xhtml" />
                   <rich:tab label="Tab3" id="tab3">
                   <ui:include src="../pages/tab3.xhtml" />

                  The problem is still not solved

                  I have attached a working project testProject2 in RF-7695 JIRA tag for your reference.


                  • 6. Re: Performance Problem using rich:tabPanel........ (solved)

                    Hi Ryan,

                    I really appreciate your efforts.
                    My uri was incorrect, hence, the code didnt work.

                    I had to use http://java.sun.com/jstl/core instead of http://java.sun.com/jsp/jstl/core.

                    Its solved now. Thanks everyone for your time and efforts.

                    I appreciate.


                    • 7. Re: Performance Problem using rich:tabPanel.