<ui:include>
runs during view build time (when XHTML is turned into JSF component tree). <p:tabView>
runs during view render time (when JSF component tree needs to produce HTML).
So, <p:tabView var>
isn't available when <ui:include>
runs. This problem is detailed in this answer: JSTL in JSF2 Facelets... makes sense? (<ui:include>
is a taghandler and has hence same lifecycle as JSTL tags).
You can solve this to a certain degree by using <c:forEach>
to produce <p:tab>
s instead of <p:tabView value>
.
<p:tabView activeIndex="#{multiTabBean.activeTabIndex}">
<c:forEach items="#{multiTabBean.tabsList}" var="useCase" varStatus="loop">
<p:tab title="#{useCase.title}" closable="true">
<f:subview id="tab_#{loop.index}">
<h:panelGroup id="mainTempPanelGroupId" layout="block">
<ui:include src="#{useCase.path}" />
</h:panelGroup>
</f:subview>
</p:tab>
</c:forEach>
</p:tabView>
It's by the way interesting to see that you somehow used <f:subview>
in your initial attempt which is completely useless over there (already taken into account by <p:tabView var>
), but it's actually helpful in here (it creates a new NamingContainer
around the tab content).