c:forEach not iterating through list in a TabView

大城市里の小女人 提交于 2019-12-25 02:01:28

问题


I have been trying to iterate through a list of tabs (my own custom tab object) by using c:forEach tag. But when I run the code, the tabs are not getting displayed. The page has no tabs.

When I debugged the code, I found that the getter method for the list object in the c:forEach items is not getting called. Please refer the below xhtml code:

<p:tabView id="tabView" dynamic="true" cache="false">   
       <p:ajax event="tabChange" listener="#{tabsController.onTabChange}" />

       <c:forEach  items="#{menusController.tabs}" var="customTab" varStatus="loop">
        <p:tab title="#{customTab.title}" >
            <f:subview id="tab_#{loop.index}">
                   <ui:include src="#{customTab.pageName}" />
            </f:subview>
            </p:tab>
         </c:forEach>
       </p:tabView>

I tried to follow the solution in this post JSF dynamically include src in "ui:include src="#{bean.pagePath}" but still it didn't work.


回答1:


You should not mixing JSP and JSF tags, c:forEach is executing before JSF parser, instead use ui:repeat.



来源:https://stackoverflow.com/questions/22086382/cforeach-not-iterating-through-list-in-a-tabview

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