7 Replies Latest reply on Jan 18, 2012 3:14 AM by iabughosh

    c:foreach doesn't work

    tuolarips Newbie

      My aim was to create tabs dynamicly, and in that purpose I was using c:foreach. But I noticed that no matter how many elements I have in ArrayList, c:foreach loops only once, giving me empty element. So that's why I tried to use c:foreach outside of the tabpanel, but I got the same result. Here is my piece of code, so if anyone has any suggestion I would be very thankful.

       

       

      <a4j:outputPanel id="output">
          <rich:tabPanel width="40%" headerAlignment="right" switchType="client">
              <rich:tab header="#{lang.tab_basic}" id="tabBasic" name="tabBasic">
              ............Content of the first non-dynamic tab..............          
              </rich:tab>
      
              <c:forEach items="#{searchSession.tabs}" var="tab">
                  <rich:tab name="#{tab.name}" >
                      <f:facet name="label">
                          <h:panelGrid columns="2">
                              <h:outputText value="#{tab.name}" />
                              <h:graphicImage value="images/icons/delete.gif" 
                                  style="width:12px; height:12px;" 
                                  onclick="myFunc('#{tab.name}'); Event.stop(event);"/>
                          </h:panelGrid>
                      </f:facet>
                      <h:outputText value="#{tab.html}" escape="false"/>
                  </rich:tab>
              </c:forEach>
      
          </rich:tabPanel>
      </a4j:outputPanel>