• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Looping over nested list

 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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<c:out 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 ]
 
Sheriff
Posts: 14691
16
Eclipse IDE VI Editor Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the second forEach, items should be "vGroup", not "vGroup.validationResult"
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic