Thanks Paul. That was definitely a good place to start. I also figured out
how to get rid of the remaining ugliness (
<%=names.get(indexId.intValue())%> ).
I use JSTL to do this for me :
<bean:define id="names" name="names" type="java.util.List" scope="page" />
<logic:iterate id="nickname" name="nicknames" indexID="index">
<tr>
<td><c:out value="${ names[ index ] }"/></td>
<td><bean:write name="nickname"/></td>
</tr>
</logic:iterate>
-----Original Message-----
From: Paul Stanton [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 30, 2004 2:55 PM
To: Struts Users Mailing List
Subject: Re: Iterating 2 Lists in parallel
you could use indexId of logic:iterate and replace <%=name%> with
<%=names.get(indexId.intValue())%>. this would save you creating the
iterator and doing .next(). a little saved, but i don't think theres a
tag to do this.
Avinash Gangadharan wrote:
> I have 2 lists of Strings. How can I have 2 iterators run in parallel
> not nested.
>
> Can some one suggest a tag( JSTL ?? ) replacement for the scriptlets
> in the code below :
>
> <%--first - lists of names--%>
> <bean:define id="names" name="names" type="java.util.List"
> scope="page" /> <% Iterator i = names.iterator(); %>
>
> <%-- second - list of nicknames for the names --%> <logic:iterate
> id="nickname" name="nicknames" >
> <%
> String name = (String)i.next();
> %>
> <tr>
> <td><%=name%></td>
> <td><bean:write name="nickname"/></td>
> </tr>
> </logic:iterate>
>
> PS: Making a object with name and nicknames as props and passing a
> list of such objects is out of my scope due to constraints.
>
> TIA
> Avinash
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]