2 Replies Latest reply on May 28, 2009 8:55 AM by christo976

    Dynamic <rich:tabPanel>

      Hello,

      I'm trying to do my first JSF app with richfaces.

      I wanna create a tabPanel like that :

      <rich:tabPanel>
      
       <rich:tab label="tab 1">
       <ui:include src="panelInsideTab.xhtml">
       <param name="param1" value="hello"/>
       </ui:include>
       </rich:tab>
      
       <rich:tab label="tab 2">
       <ui:include src="panelInsideTab.xhtml">
       <param name="param2" value="goodbye"/>
       </ui:include>
       </rich:tab>
      
      </rich:tabPanel>


      but the tabs inside the tabMenu must be created dynamically with the values from a backingbean....so I tried this :

      <rich:tabPanel>
       <ui:repeat value="#{tabBean.list}" var="tab">
       <rich:tab label="#{tab.name}">
       <ui:include src="panelInsideTab.xhtml">
       <param name="param1" value="#{tab.message}"/>
       </ui:include>
       </rich:tab>
       </ui:repeat>
      </rich:tabPanel>


      unfortunately, it doesn't work and I get that error message :
      "tab panel has no enabled or rendered tabs!"

      then I tried to bind the tabPanel with a method...

      <rich:tabPanel binding="#{tabBean.tabPanel}"/>


      public HtmlTabPanel getTabPanel() {
      
       tabPanel = new HtmlTabPanel();
      
       HtmlTab tab = null;
       for (Person p : getList()) {
       tab = new HtmlTab();
       tab.setLabel(p.getName());
      
       tabPanel.getChildren().add(tab);
       }
       return tabPanel;
      }
      

      ..but how can I include a page inside each panel (<ui:include src="panelInsideTab.xhtml">) ?

      I will really appreciate your help.
      Thank you !!!

      Chris