0

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.

Community
  • 1
  • 1
Manish
  • 710
  • 3
  • 12
  • 25

1 Answers1

0

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

Damian S.
  • 128
  • 1
  • 7