Hallo,
I posted already in the Seam forum without getting any answer yet:
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><h:outputLink value="#{child.htmlLink}">#{child.textValue}</h:outputLink><rich:panelMenuItem label="#{child.textValue}" value="#{child.htmlLink}" submitMode="server">@Entity
@Table(name = "MENU_ITEM")
public class MenuItem implements java.io.Serializable
{
private String id;
private MenuItem parent;
private String viewId;
private String textValue;
private String htmlLink;
private Set<MenuItem> childs = new HashSet<MenuItem>(0);
:
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "parent")
public Set<MenuItem> getChilds() {
return this.childs;
}
public void setChilds(Set<MenuItem> childs) {
this.childs = childs;
}
}