Here's what I have done:

out.println("<table cellspacing=0 cellpadding=0 width=600>");
  int row = 1;
  String color = "";
   while(rec.next())
   {
    if((row%2)==0)
   {
    color = "white";
   }
   else
    color = "DDDDDD";

    out.println("<tr bgcolor="  + color + "><td ><a href=" +
rec.getString("URL") + "" + " target=\"_blank\"" + ">" +
rec.getString("Description") + "</a></td><td>  Category:  "
    + rec.getString("CatName") + "<br></td></tr>");
    row++;
   }
   out.println("</table>");

It's not beautiful, but it works.

JJR

Michael Mok wrote:

> Hi,
>
> I am using the <logic:iterate> tag to loop through my SQL query result and
> displaying them. Is there a way to display the rows such that they are
> displayed with different colors (eg odd rows blue even rows red)?
>
> I thought of coding additional java code in the JSP page to sett the color
> of the row (I am displaying my rows in a HTML
> <table><tr><td></td></tr></table>)within the <logic:iterate>.
>
> Maybe an enhancement can be made to the <struts:logic> tag to take a style
> sheet setting for specifying a row color combination of some sort or a new
> <struts:logic-table> tag for displaying collections.
>
> Any opinion?
>
> Michael Mok

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


Reply via email to