Thanks for all your replies. Writing a scriplet is no brainer but I am
trying to avoid them ( I was successful so far).
Since my collection consists of beans and each bean represents a row i just
added an extra member variable (sequence) which indicates if the row is odd
or even. In this case you don't need any scriplets.
=========================================================================
<logic:iterate id="exchangeRate" name="cache" property="displayRates">
<logic:equal name="exchangeRate" property="sequence"
scope="page" value="0">
<tr class="even">
</logic:equal>
<logic:equal name="exchangeRate" property="sequence"
scope="page" value="1">
<tr class="odd">
</logic:equal>
<td class="td0" align="middle">
<bean:write name="exchangeRate" property="currency"
filter="true"/>
</td>
<td class="td0" align="middle">
<bean:write name="exchangeRate" property="rate" filter="true"/>
</td>
<td class="td0" align="middle">
<bean:write name="exchangeRate" property="rateType"
filter="true"/>
</td>
</tr>
</logic:iterate>
============================================================================
==
Mark.
> -----Original Message-----
> From: Bart Moberts [SMTP:[EMAIL PROTECTED]]
> Sent: Thursday, April 19, 2001 6:26 AM
> To: [EMAIL PROTECTED]
> Subject: Re: How to display odd/even rows using iterator
>
>
> hello
>
> i do it this way:
>
> <%! String[] colors = new String[2]; int i = 0; %>
> <% colors[0]="#EEEEEE"; colors[1]="#CECECE"; i = 0;%>
> <logic:iterate id="..." name="..." property="...">
>
> <% i = 1 - i; %>
>
> <tr bgcolor= <%= colors[i] %> >
> ...
> </tr>
>
> </logic:iterate>
>
> grtz
>
>
> >From: "Zeltser, Mark" <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: [EMAIL PROTECTED]
> >Subject: How to display odd/even rows using iterator
> >Date: Wed, 18 Apr 2001 12:00:54 -0400
> >
> >Hello,
> >
> >I have the following code to build the table:
> >=========================================================================
> ===
> >==
> > <logic:iterate id="exchangeRate" name="cache"
> >property="displayRates">
> > <tr>
> > <td class="td0" align="middle">
> > <bean:write name="exchangeRate" property="currency"
> >filter="true"/>
> > </td>
> > <td class="td0" align="middle">
> > <bean:write name="exchangeRate" property="rate"
> filter="true"/>
> > </td>
> > <td class="td0" align="middle">
> > <bean:write name="exchangeRate" property="rateType"
> >filter="true"/>
> > </td>
> > </tr>
> > </logic:iterate>
> >=========================================================================
> ===
> >==
> >
> >I would like to set different colors for odd/even rows. How do I do this?
> >
> >Thanks, Mark.
> >
> >
> >-------------------------------------------------------------------------
> -----
> >This message is intended only for the personal and confidential use of
> the
> >designated recipient(s) named above. If you are not the intended
> recipient
> >of this message you are hereby notified that any review, dissemination,
> >distribution or copying of this message is strictly prohibited. This
> >communication is for information purposes only and should not be regarded
>
> >as an offer to sell or as a solicitation of an offer to buy any financial
>
> >product, an official confirmation of any transaction, or as an official
> >statement of Lehman Brothers Inc. Email transmission cannot be
> guaranteed
> >to be secure or error-free. Therefore, we do not represent that this
> >information is complete or accurate and it should not be relied upon as
> >such. All information is subject to change without notice.
> >
> >
>
> _________________________________________________________________________
> Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
------------------------------------------------------------------------------
This message is intended only for the personal and confidential use of the designated
recipient(s) named above. If you are not the intended recipient of this message you
are hereby notified that any review, dissemination, distribution or copying of this
message is strictly prohibited. This communication is for information purposes only
and should not be regarded as an offer to sell or as a solicitation of an offer to buy
any financial product, an official confirmation of any transaction, or as an official
statement of Lehman Brothers Inc. Email transmission cannot be guaranteed to be
secure or error-free. Therefore, we do not represent that this information is
complete or accurate and it should not be relied upon as such. All information is
subject to change without notice.