Working on a school-project when suddenly we found a task that is so repetitive that we decided to make a partialView out of it. It basically is a table compiled out of a list saved in a @Named and @SessionScoped (both CDI) bean.
The code of partialView.xhtml:
<ui:composition>
    <h:dataTable
            /* Style */>
        <c:forEach items="#{playListVM.playList.songs}" var="song">
            <f:facet name="caption">
                #{playListVM.playList.name}
            </f:facet>
            <h:column>
                <f:facet name="header">Index</f:facet>  
                #{playListVM.playList.songs.indexOf(song)+1}
            </h:column>
...
I want to call this "method" multiple times like so:
The code of home.xhtml:
<c:forEach items="#{c.playLists}" var="playList">
    <ui:include src="#{c.playListPV(playList)}" />          
</c:forEach>
playListPV(playlist) sets the value of playListVM.playList to playList and returns the path to the .xhtml file.
First we tried it only with h:dataTable which worked fine as long as we used the partialView once per render (otherwise it used the same reference and every PV was identical). So I googled some more and fond out that I just overwrite the object everytime I invoked the method. Then I read this article about c:forEach and the order the things are rendered. Here we are.
By now I think the whole approach is wrong...
 
     
     
    