How to pass parameters to ui:include that inside of c:forEach tag

女生的网名这么多〃 提交于 2019-12-02 14:54:31

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!