问题
We are trying to create a list with iterating an entity with ui:include.
my .xhtml
file is like;
<c:forEach items="#{entityHome.list}" var="entityId">
<ui:include src="/some.xhtml">
<ui:param name="id" value="#{entityId}" />
</ui:include>
</c:forEach>
We have already created a .xhtml
file to visualize single entity. Not we want a list of all entities. Firstly we were using a h:dataGrid
but according to this we changed it to c:forEach
.
Now when page is rendered, fields in /some.xhtml
are empty. I think we cant pass parameter to ui:include
. By cant i mean for this situation.
Any idea?
Thanks.
回答1:
I just had the same problem, what I did to solve it was putting another ui:param above the ui:include, and then link that param to the param inside the ui:include :
<c:forEach items="#{entityHome.list}" var="entityId">
<ui:param name="someId" value="#{entityId}"/>
<ui:include src="/some.xhtml">
<ui:param name="id" value="#{someId}" />
</ui:include>
</c:forEach>
This seemed to do the trick for me.
来源:https://stackoverflow.com/questions/7526332/how-to-pass-parameters-to-uiinclude-that-inside-of-cforeach-tag