2 Replies Latest reply on Jul 12, 2008 10:47 AM by Saravanan Vijayappan

    UI repeat is not looping

    Saravanan Vijayappan Newbie

      Hello

      I am using facelets.12, JSF RI 1.7 and Richfaces 3.2 in my project. For my below facelets code, the expected output is coming

      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:c="http://java.sun.com/jsp/jstl/core">
      
      <ui:composition>
      <h:form>
       <ui:repeat value="#{applicationScope.menuGroups}" var="menu">
       <br/><br/><h:outputText value="#{menu.name}"/>:
       <ui:repeat value="#{menu.catgroups}" var="menuItem">
       <h:outputText value="#{menuItem.name}"/>,
       </ui:repeat>
       </ui:repeat>
      </h:form>
      </ui:composition>
      </html>


      Output

      Computer:Computers ,Hard Drive ,Monitor & Projector ,Personal Electronics ,A/V Essentials ,Flash Memory ,Home Audio ,
      
      Electronics:CDs/DVDs ,Networking ,Video ,Components ,



      I modified the above code little bit to dynamically create menuItem by using richfaces UI components.
      But in my below code, the inner most <ui:repeat> is not looping even single time. The UI menuItem is not created under the drop down. I tested by putting <h:outputText value="#{menuItem.name}"/> inside of inner ui:repeat, it is not displayed. Hence, the inner most ui:repeat is not looping at all :-(


      <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:ui="http://java.sun.com/jsf/facelets"
       xmlns:a4j="http://richfaces.org/a4j"
       xmlns:rich="http://richfaces.org/rich"
       xmlns:f="http://java.sun.com/jsf/core"
       xmlns:h="http://java.sun.com/jsf/html"
       xmlns:c="http://java.sun.com/jsp/jstl/core">
      
      <ui:composition>
      
       <style>
       .pic {
       margin-bottom: -4px;
       margin-right: 2px;
       }
       </style>
      
      <h:form>
      <rich:toolBar itemSeparator="line">
       <ui:repeat value="#{applicationScope.menuGroups}" var="menu">
       <rich:dropDownMenu>
       <f:facet name="label">
       <h:panelGroup>
       <h:graphicImage value="/images/icons/copy.gif" alt="" styleClass="pic"/>
       <h:outputText value="#{menu.name}"/>
       </h:panelGroup>
       </f:facet>
       <ui:repeat value="#{menu.catgroups}" var="menuItem">
       <rich:menuItem submitMode="ajax" value="#{menuItem.name}" ajaxSingle="true"></rich:menuItem>
       </ui:repeat>
       </rich:dropDownMenu>
       </ui:repeat>
      </rich:toolBar>
      </h:form>
      </ui:composition>
      </html>


      I am not able to figure out why the inner <ui:repeat> is not looping even single time. I tried using <a4j:repeat>, but, got the same result (not working as expected). Could anyone help me what's wrong in the code or something going wrong in <ui:repeat>

      Thanks
      Sarav