3 Replies Latest reply on Apr 3, 2007 8:29 PM by sergeysmirnov

    Remember the selected tab?

    kingcu

      Hi,

      I have a page with 3 rich:tabs and on the same page, there are some links/buttons that navigate to other pages. How can I have the page remember which tab was selected before when navigation comes back to the page? Any idea?

      Thanks,
      Tong

        • 1. Re: Remember the selected tab?

          The following code show the second tab when page is rendered (re-rendered):

          <rich:tabPanel selectedTab="t2">
           <rich:tab label="tab 1" name="t1">
           <h:outputText value="tab 1" />
           </rich:tab>
           <rich:tab label="tab 1" name="t2">
           <h:outputText value="tab 2" />
           </rich:tab>
           <rich:tab label="tab 1" name="t3">
           <h:outputText value="tab 3" />
           </rich:tab>
          </rich:tabPanel>


          So, you can use EL for selectedTab attribute to point to the tab that should be active.


          • 2. Re: Remember the selected tab?
            kingcu

            Can you please elaborate on the EL part? I am using JBoss Seam and all the navigation is configured in the xxxx.page.xml, not sure how to pass a parameter around and then reference it. Thanks.

            • 3. Re: Remember the selected tab?

              JBoss Seam is not an area of my expertise yet. If remember correctly, you can make initialization for bean properties right in the xxxx.page.xml file.