c:forEach未遍历TabView中的列表 [英] c:forEach not iterating through list in a TabView
问题描述
我一直在尝试使用c:forEach标记遍历选项卡列表(我自己的自定义选项卡对象).但是,当我运行代码时,选项卡没有显示.该页面没有标签.
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.
当我调试代码时,我发现c:forEach项目中的列表对象的getter方法没有被调用.请参考下面的xhtml代码:
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>
我试图遵循本文中的解决方案 JSF动态地在"ui:include src ="#{bean.pagePath}" 中包含src,但仍然无法正常工作.
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.
推荐答案
您不应混用JSP和JSF标记,c:forEach在JSF解析器之前执行,而应使用ui:repeat.
You should not mixing JSP and JSF tags, c:forEach is executing before JSF parser, instead use ui:repeat.
这篇关于c:forEach未遍历TabView中的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!