1 Reply Latest reply on Jul 2, 2010 6:06 AM by Mister Face

    rich:tabPanel with dynamically listed tabs

    Mister Face Newbie

      Hi!

       

      I'm using JSF1.2, Richfaces3.3.3, Tomcat6. I try to have a rich:tabpanel with dynamically listed tabs usng <c:forEach> tag:

       

       

      <?xml version="1.0" encoding="ISO-8859-1" ?>
      <jsp:root version="2.0" xmlns:jsp="http://java.sun.com/JSP/Page"
          xmlns:c="http://java.sun.com/jstl/core"
          xmlns:ui="http://java.sun.com/jsf/facelets"
          xmlns:h="http://java.sun.com/jsf/html"
          xmlns:f="http://java.sun.com/jsf/core"
          xmlns:rich="http://richfaces.org/rich"
          xmlns:a4j="http://richfaces.org/a4j"
          xmlns:security="http://www.springframework.org/security/tags">
      
          <jsp:directive.page contentType="text/html;charset=ISO-8859-1"
              pageEncoding="ISO-8859-1" session="false" />
          <jsp:output doctype-public="-//W3C//DTD XHTML 1.1//EN"
              doctype-system="http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"
              doctype-root-element="html" omit-xml-declaration="false" />
      
      <f:view>
      <html>
          <head>
                <title><h:outputText value="#{msg_bundle.website_title}"/></title>
          </head>
          <body>
              <center><h:form id="main">
                  <a4j:outputPanel id="tabWrapper">
                      <rich:tabPanel id="panel_tab" height="500" width="980" >
                          <rich:tab id="mainoverview">
                               <f:facet name="label">
                                  <h:panelGroup>
                                      <h:outputText value="Overview" />
                                  </h:panelGroup>
                               </f:facet>
                               <h:outputText value="text text tex text" />
                               <!-- some content -->
                          </rich:tab>
                          
                          <c:forEach items="#{dynamicTab.tabs" var="tab" begin="1">
                              <rich:tab name="tab_#{tab.id}" rendered="true" >
                                 <f:facet name="label">
                                      <h:panelGroup>
                                          <h:outputText value="#{tab.aktenzeichen}" />
                                      </h:panelGroup>
                                  </f:facet>
                                  <h:outputText value="Bericht #{tab.aktenzeichen}" />
                             </rich:tab>
                          </c:forEach>
                          
                      </rich:tabPanel>
                  </a4j:outputPanel>
              </h:form></center>
          </body>
      </html>
      </f:view>
      </jsp:root>
      
      

       

       

      <c:forEach> just doesn't print any output. When I remove begin="1" in this Tag I get exactly one added tab without any label or content.

      I tried to use <a4j:repeat> and <ui:repeat> as well, but as everybody on the internet says, it's just not compatible with <rich:tabpanel>

       

      Here's my Session Bean and a Model:

       

       

      public class DynamicTab {
          
          private List<CustomTab> tabs;
          int i=1;
      
          public DynamicTab() {
              tabs= new ArrayList<CustomTab>();
              tabs.add(new CustomTab(i++,"test"));
          }
      
          public List<CustomTab> getTabs() {
              return tabs;
          }
      }
      
      /*******************************************/
      
      public class CustomTab {
          
          private int id;
          private String aktenzeichen;
          
          public CustomTab() {
              // TODO Auto-generated constructor stub
          }
          
          public CustomTab(int id, String aktenzeichen) {
              this.id= id;
              this.aktenzeichen= aktenzeichen;
          }
      
          public int getId() {
              return id;
          }
      
          public void setId(int id) {
              this.id = id;
          }
      
          public String getAktenzeichen() {
              return aktenzeichen;
          }
      
          public void setAktenzeichen(String aktenzeichen) {
              this.aktenzeichen = aktenzeichen;
          }
      }
      

       

       

      I can list the content of my tab list within a panel with a4j:reapeat and in the console. so there is data.

      Any ideas why - the f*** - there is no output or error message?

       

      regards