2 Replies Latest reply on May 29, 2012 6:14 AM by Ahmed Fawzy

    TabPanel ajax switching not working

    Ahmed Fawzy Newbie

      Hi all, I know that this has been discussed before but I couldn''t get any solution within those discussions to solve my issue, I'm still new to jsf and richfaces and I'm stuck with the following:

       

      <rich:tabPanel id="myTabPanel" switchType="ajax" itemChangeListener="#{myTabBean.changeTabActiveItem}" activeItem="#{myTabBean.activeTab}" immediate="true">

          <rich:tab name="staticTab1" header="Static Tab 1">

              <ui:include src="/WEB-INF/widget/widget1.xhtml" />

          </rich:tab>

          <rich:tab name="staticTab2" header="Static Tab 2">

              <ui:include src="/WEB-INF/widget/widget2.xhtml" />

          </rich:tab>

          <c:forEach items="#{myTabBean.dynamicTabs}" var="dynamicTab" varStatus="status">

              <rich:tab name="#{dynamicTab.id}" header="#{dynamicTab.title}">

                  <h:outputText value="some content" />

              </rich:tab>

          </c:forEach>

      </rich:tabPanel>

       

       

      Simply this piece of tag doesn't switch tabs when I click on each tab or even fire the action listener, however, it works when I change the switchType to "server" or "client". Here are some of the libraries that I'm using:

       

      jstl-api-1.2.jar

      jstl-impl-1.2.jar

      richfaces-components-api-4.0.0.Final.jar

      richfaces-components-ui-4.0.0.Final.jar

      richfaces-core-api-4.0.0.Final.jar

      richfaces-core-impl-4.0.0.Final.jar

      javax.faces-2.1.4.jar

       

      Thanks in advance for any help.

        • 1. Re: TabPanel ajax switching not working
          Mahesh Bonagiri Newbie

          what is the scope of your bean.

          can you please post ur managed bean code.

          • 2. Re: TabPanel ajax switching not working
            Ahmed Fawzy Newbie

            Thanks for your reply Mahesh, the bean is session scoped. here is the code for the bean.

             

             

            @ManagedBean(name = "myTabBean")

            @SessionScoped

            public class MyTabBean {

             

             

                      private String activeTab;

                      private List<DynamicTab> dynamicTabs = new ArrayList<DynamicTab>();

             

             

                      public MyTabBean() {

                                dynamicTabs.add(new DynamicTab("dtab1", "Dynamic Tab 1"));

                                dynamicTabs.add(new DynamicTab("dtab2", "Dynamic Tab 2"));

                                dynamicTabs.add(new DynamicTab("dtab3", "Dynamic Tab 3"));

                      }

             

             

                      public String getActiveTab() {

                                return activeTab;

                      }

             

             

                      public void setActiveTab(String activeTab) {

                                this.activeTab = activeTab;

                      }

             

             

                      public void changeTabActiveItem(ItemChangeEvent event) {

                                this.setActiveTab(event.getNewItemName());

                                // some application logic goes here.

                      }

            }