4 Replies Latest reply on Nov 6, 2013 11:13 AM by uipko

    Dynamic menu rendering in Richfaces 4

    uipko

      I'm working on the migration of an application from richfaces 3 to richfaces 4.3.3, we use myfaces 2.1.12 and tomcat 6.0.35.

       

      I've the following problem. The buttons on my datascroller aren't working, this seems to be caused by the following error

       

      <partial-response>
        <error>
          <error-name>java.lang.IllegalStateException</error-name>
          <error-message><![CDATA[component with duplicate id "searchForm:j_id_6z" found]]></error-message>
        </error>
      </partial-response>
      

       

      The problem is that we use c:forEach to loop over the menu items. If I understand this correctly c:forEach brakes the partial state rendering. The solution would be to use ui:repeat but this doesn't work to populate menuItems.

       

      The question is how can I dynamicly populate a menu without braking the partial state rendering?

       

      This is a simplified version of the code which generates the problem:

                <rich:dropDownMenu>
                  <f:facet name="label">
                    <h:panelGroup>
                      <h:outputText value="#{msg['menu_dropdown']}" />
                    </h:panelGroup>
                  </f:facet>
                  
                  <c:forEach items="#{bean.items}" var="item">
                    <rich:menuItem action="#{item.go}" immediate="true">
                      #{item.name}" />
                    </rich:menuItem>
                  </c:forEach>
                  
                </rich:dropDownMenu>