Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

<c:forEach> iterating through multiple collections in parallel

843838Jul 26 2007 — edited Jul 26 2007
Hi there,

I have two arrayLists, one contains a list of ids and the other contains a list of names. The ids and the names in a particular position in their arrayList correspond so that the id in position one corresponds to the name in position one.

I want to use <c:forEach> to iterate through these arraylists so that the names and corresponding Ids are printed together. Is this possible?

For example, I want to use the id as part of a url and the name to be what the user clicks on.
<c:forEach var="k" items="${inbox.id}">
            <a href="ProfileServlet?id=${k}">${inbox.name[x]}</a>, 
</c:forEach>
Is there a way to perhaps increment a variable, x in ${inbox.name[x]}

Hope Im making myself clear! Thanks!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 23 2007
Added on Jul 26 2007
5 comments
229 views