2 Replies Latest reply on Jul 27, 2007 4:37 AM by aboulouay83

    JSF TAB PROBLEM

    aboulouay83

      Hi,

      I am using Tabbed panes in JSF(richfaces). I want to display the second tab and not the first tab when the page refreshes. How can I do that?

      Thanks.

        • 1. Re: JSF TAB PROBLEM
          budoray

          Declare private int tabIndex in your bean class. Provide a setter and getter for it. The example below should help you get started

          
          ...YOUR_BEAN class
          
          private int tabIndex;
          
          public int getTabIndex() {
           return tabIndex;
          }
          
          public void setTabIndex(int tabIndex) {
           this.tabIndex = tabIndex;
          }
          
          public String changeTabs(){
           return "";
          }
           ...
          
          <rich:tabPanel selectedTab="#{YOUR_BEAN.tabIndex}" >
           <rich:tab>
           <t:commandButton value="One" action="#{YOUR_BEAN.changeTabs}" />
           </rich:tab>
           <rich:tab>
           <t:commandButton value="Two" action="#{YOUR_BEAN.changeTabs}" />
           </rich:tab>
           <rich:tab>
           <t:commandButton value="Three" action="#{YOUR_BEAN.changeTabs}" />
           </rich:tab>
           </rich:tabPanel>
          


          • 2. Re: JSF TAB PROBLEM
            aboulouay83

            thanks a lot for your help i will test it