make sure you do count%2 instead of count%1

make sure your initialization of count in the right place,
<%
int count = 0;
String bgcolor;
...
%> looks dangerous, i didn't read your full code, but seems you are
assigning count to 0 eachtime, you need pull count=0 absolutely outside of
the possible loop. Then how can you not get "lightgrey" all the time

Dawei
-----Original Message-----
From: A mailing list about Java Server Pages specification and reference
[mailto:[EMAIL PROTECTED]]On Behalf Of Dan Lopez
Sent: Wednesday, February 14, 2001 9:57 AM
To: [EMAIL PROTECTED]
Subject: Re: Rowcolor...


I followed the mod2 framework as provided in the
example.  It still doesnt change color :(.  Provided
is a sample of the code I have been trying
out...Please
point me in the right direction, I am stuck.  Thanks a
bunch!

CODE==================================================

<% {Resultset Gotten here and formatted with
taglibs}%>

<%
int count = 0;
String bgcolor;
if (count%2 == 0) {
bgcolor="lightgrey";
} else {
bgcolor="lightblue";
}
count++;
%>

<tr bgcolor="<%= bgcolor %>">
 <td width="189" height="17">
   <div align="left"><%= a %></div>
 <td width="189" height="17">
   <div align="left"><%= b %></div>
    <td width="182" height="17">
      .
      .
      ....etc...
  </tr>

=====================================================


--- "Straight, Christian" <[EMAIL PROTECTED]> wrote:
> This works fine but shouldn't that be mod2 as
> follows:
>
> int count = 0
> String bgcolor;
>
> if (count%2 == 0)
>    bgcolor="some color";
> else
>    bgcolor="some other color";
>
> count++;
>
>
> Christian Straight
> Inovant
>
>


__________________________________________________
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

===========================================================================
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

Reply via email to