Just iterate over it using <ui:repeat>
or <h:dataTable>
the usual way. It's perfectly valid to nest multiple iterating components in each other. In case of <h:dataTable>
, you only need to make sure that you put the nested iterating component inside a <h:column>
.
E.g.
<h:dataTable value="#{bean.entities}" var="entity">
<h:column>
#{entity.property}
</h:column>
<h:column>
<ui:repeat value="#{entity.subentities}" var="subentity">
#{subentity.property}
</ui:repeat>
</h:column>
</h:dataTable>
or
<h:dataTable value="#{bean.entities}" var="entity">
<h:column>
#{entity.property}
</h:column>
<h:column>
<h:dataTable value="#{entity.subentities}" var="subentity">
<h:column>
#{subentity.property}
</h:column>
</h:dataTable>
</h:column>
</h:dataTable>
You'll potentially only run into issues when you nest multiple <ui:repeat>
components and use <f:ajax>
in it while using an older version of Mojarra.
Only JSTL <c:forEach>
wouldn't work when nested inside a JSF iterating component for the reasons explained here JSTL in JSF2 Facelets... makes sense?
Unrelated to the concrete problem, please don't abuse <h:outputLabel>
for pure text presentation. It generates a HTML <label>
element which is intented to label an input element by for
attribute. However, you're doing that nowhere in the code. You should be using <h:outputText>
instead. By the way, I'm lately seeing this more often in code of starters. There must be somewhere a bad tutorial or resource which is abusing the <h:outputLabel>
this way instead of <h:outputText>
or even plain EL in template text. Which tutorial/resource was you using? Then I can contact the author about this severe misinstruction. See also Purpose of the h:outputLabel and its "for" attribute