How to use to iterate over a nested list?

What you need is to nest another <ui:repeat> tag in your outer iteration:

<ui:repeat value="#{bean.listOfA}" var="a">
    ...
    <ui:repeat value="#{a.listOfB}" var="b">
        ...
    </ui:repeat>
</ui:repeat>

The only thing left that is worth noting is that nested <ui:repeat> tags used to have problems with state management until Mojarra 2.1.15 version (details in jsf listener not called inside nested ui:repeat and in many not so recent questions and their answers), which could result in action listeners not called, etc. but if you’re currently on the latest Mojarra JSF implementation – just skip this part altogether.

Leave a Comment