Yes I do it to set the row bgcolor.
<logic:iterate id="result" indexId="inx" name="test.SEARCH_RESULT" type="test.SearchResult">
<% if ( inx.intValue() % 2 == 0 ) { %>
<tr>
<% } else { %>
<tr bgcolor="#cccccc">
<% } %>
From: "Andy Kriger" <[EMAIL PROTECTED]>
Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Subject: RE: iterate tag - can you set an increment?
Date: Tue, 19 Nov 2002 12:43:37 -0500
And last but not least, is it possible to do test in logic:equal that
involve equations? For example, is index%2==0? (or do I need JSTL for this)?
-----Original Message-----
From: Karr, David [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, November 19, 2002 12:34
To: Struts Users Mailing List
Subject: RE: iterate tag - can you set an increment?
Certainly. It's available as a scripting variable within the loop (and as a
page-scoped attribute).
> -----Original Message-----
> From: Andy Kriger [mailto:[EMAIL PROTECTED]]
>
> Is it possible to access the idx variable in a scriplet
> during iteration?
>
> -----Original Message-----
> From: Andy Kriger [mailto:[EMAIL PROTECTED]]
>
> Is there any way to set an iteration increment on the iterate tag? For
> example, iterate through the array returning every 2nd item.
>
> If not, can anyone tell me how I might do this without resorting to
> scriplets (or only using them minimally)? Here's the code I'm
> trying to use.
> The first TD is the long_desc field of array[idx] in myBean. How can I
> increment idx so I can get the next item? (maybe I'm being
> slow since I
> haven't had my coffee yet)
>
> <logic:iterate id="idx" name="myBean" property="array"
> scope="session">
> <tr>
> <td><bean:write name="idx" property="long_desc"/></td>
> <td><bean:write name="???" property="long_desc"/></td>
> </tr>
> </logic:iterate>
--
To unsubscribe, e-mail:
<mailto:[EMAIL PROTECTED]>
For additional commands, e-mail:
<mailto:[EMAIL PROTECTED]>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
_________________________________________________________________
MSN 8 helps eliminate e-mail viruses. Get 2 months FREE*. http://join.msn.com/?page=features/virus
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

