Why not just use the % operator?
int count = 0
String bgcolor;
if (count%1 == 0)
bgcolor="some color";
else
bgcolor="some other color";
count++;
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Julia Reynolds
Sent: Friday, February 09, 2001 9:08 AM
To: [EMAIL PROTECTED]
Subject: Re: Row Color
Here's an old post from the Struts JSP framework mailing list. The user is
using
the Struts
iterate tag from the Struts tag library to loop through records from a bean
and a ternary if to alternate colors based on odd or even number of row:
<% int count=0; %>
<struts:iterate id="row" name="currentReport" property="data" >
<tr BGCOLOR='<%= (count++ % 2==0 ?"#FFFFAA":"#EEEEEE") %>' >
<td> <%= count %> </td>
<struts:iterate id="item" collection="<%= row %>" >
<td nowrap align=MIDDLE > <%=(item).toString() %> </td>
</struts:iterate>
</tr>
</struts:iterate>
Struts home page: http://jakarta.apache.org/struts/index.html
Dan Lopez wrote:
> I want to alternate row color. I have seen it...how
> is it done? Need help asap!
>
> Thanks
>
> __________________________________________________
> Do You Yahoo!?
> Get personalized email addresses from Yahoo! Mail - only $35
> a year! http://personal.mail.yahoo.com/
>
>
===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
--
In a time of drastic change it is the learners who inherit the future. The
learned
find themselves equipped to live in a world that no longer exists. - Eric
Hoffer
H e a l t h S t r e a m, I n c.
Julia Reynolds - Systems Developer
209 10th Ave. South Ste. 450 - Nashville, TN 37203
phone: (615) 301-3220 - fax: (615) 301-3200
email: [EMAIL PROTECTED]
Web Site: http://www.cmecourses.com
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff
JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST
DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets