2 Replies Latest reply on Sep 2, 2010 8:54 PM by petrik.mich

    Dynamic Menu from database

    victoriaonsnow.viktor.rees.nexgo.de

      Hallo,
      I want to create a menu dynamically by reading the menu items  from database. The following code sniplet works quite  well, except that the Menu collapses after each click on an menu item:


      <h:form>
        <rich:panelMenu  mode="server" expandMode="server">
           <c:forEach items="#{appMenu.menuItems}" var="item">
             <rich:panelMenuGroup label="#{item.textValue}" >
                <c:forEach items="#{item.childs}" var="child">
                  <rich:panelMenuItem submitMode="none">
                     <s:link view="#{child.htmlLink}">
                       <h:outputText value="#{child.textValue}"></h:outputText>
                     </s:link>                                   
                  </rich:panelMenuItem>
                </c:forEach>
             </rich:panelMenuGroup>
           </c:forEach>
        </rich:panelMenu>
      </h:form>



      I tried several variations:



      • instead of <s:link> i tried



      <h:outputLink value="#{child.htmlLink}">#{child.textValue}</h:outputLink>


      Result was an incorrect url:  http://localhost:8080/AppUserList.xhtml
      instead of http://localhost:8080/AdaptTemplates/AppUserList.seam?cid=109



      • Instead of <s:link> i tried




      <rich:panelMenuItem label="#{child.textValue}" value="#{child.htmlLink}" submitMode="server">



      Result: Menu items get rendered as hidden input fields  instead of Links to seam views. 


      Can somebody help?