0
votes

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
Do you really need to have a <ui:include> inside your <p:tabView> ? - Pellizon
Yes, its really required for the project!!! - Manish
Does no one have an answer for this? - Manish

1 Answers

0
votes

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