This week's book giveaway is in the Performance forum.
We're giving away four copies of The Java Performance Companion and have Charlie Hunt, Monica Beckwith, Poonam Parhar, & Bengt Rutisson on-line!
See this thread for details.
Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Looping over nested list

 
Cemil Ozdemir
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

I am new to jsp so i have a question i hope someone can help me with.

I have a ArrayList (1) that contains ArrayLists(2).

The latter ArrayList contains ValidationResult objects.

I am using Spring, and i add the first ArrayList with the name validationGroup:
modelData.put("validationGroup", validationGroup);

On my jsp page i want to iterate over ArrayList (1) and retrieve the ArrayList(2), so i can iterate over the ValidationResult objects in ArrayList(2).

This is how my code looks like now:
<c:forEach var="vGroup" items="${validationGroup}" varStatus="counter">
<c:if test="${not empty vGroup}">
<c:forEach var="gr" items="${vGroup.validationResult}" varStatus="counter">
<tr class="row<cut value="${counter.count % 2 + 1}" />" valign="top"

But this is wrong.

How do i iterate over a nested ArrayList that contains ValidationResult objects ?

Hope somone can help me...

Best Regards
Cemil
[ November 23, 2006: Message edited by: Cemil OZdemir ]
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the second forEach, items should be "vGroup", not "vGroup.validationResult"
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic