jsf 2 - Dynamically generate rich menuitems inside rich context menu -
i trying dynamically generate rich menu items inside rich context menu component. here code:
<ui:repeat var="group" value="#{mybean.groups}" > <div align="center"> <rich:panel> <h:graphicimage value="#{group.iconurl}"/> <rich:contextmenu attached="true"> <c:foreach var="child" items="#{group.children}"> <rich:menuitem label="#{child.name}" /> </c:foreach> </rich:contextmenu> </rich:panel> </div> </ui:repeat>
i using tag library :
xmlns:c="http://java.sun.com/jsp/jstl/core
my problem menu items aren't being generated. have tried replacing c:foreach ui:repeat still won't work.
i tried little experimentation eliminate factors. removed rich context menu , used ui:repeat
<ui:repeat var="group" value="#{mybean.groups}" > <div align="center"> <rich:panel> <h:graphicimage value="#{group.iconurl}"/> <ui:repeat var="child" value="#{group.children}"> <h:outputtext value="#{child.name}" /> </ui:repeat> </rich:panel> </div> </ui:repeat>
this code snippet above worked. guess there conflict rendering of context menu , ui repeat.
sadly, kind of need place group.children in rich context menu component. can suggest approach me achieve want?
note: using servlet version 3.0
the <c:foreach>
runs during view build time, when xhtml file transformed jsf component tree. <ui:repeat>
runs during view render time, when jsf component tree produce html.
so, in particular example, @ moment <c:foreach>
runs, #{group}
variable definied <ui:repeat>
available in el scope , <c:foreach>
retrieves null
items value , hence has nothing iterate over.
your construct work if replace outer <ui:repeat>
<c:foreach>
well.
Comments
Post a Comment