How to iterate over a list of lists in jstl?

I have a list in this format:

List<List<Obj>> l3 = new ArrayList<List<Obj>>();

      

Obj contains a getVal method.

How can I output the getVal value for each Obj object?

I can iterate over the list using:

<c:forEach var="mylist" items="${mylist}">

    <c:out value="${mylist.val}"></c:out>

    </c:forEach>

      

But how do I get the values ​​contained in a list of lists?

+3


source to share


1 answer


Just like you did it in Java - with nested loops:



<c:forEach var="innerList" items="${mylist}">
    <c:forEach var="obj" items="${innerList}">
        <c:out value="${obj.val}"></c:out>
    </c:forEach>
</c:forEach>

      

+9


source







All Articles