wood burning stoves 2.0
The moose likes Struts and the fly likes alternate row color Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Make it so: Java DB Connections & Transactions this week in the JDBC forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "alternate row color" Watch "alternate row color" New topic

alternate row color

arjun rampal
Ranch Hand

Joined: Jul 08, 2005
Posts: 125
Hi I have to make alternate color rows.

now possible solution is below but it is giving one extra line below table.so i dont want to use this.

is there any idea

int num = 0;
String SLATE = "#E4E4E4";
String WHITE = "#FFFFFF";
String bgColor = null;

<logic:iterate id="element" name="dateMap">
if((num % 2) == 0) {
bgColor = SLATE;
} else {
bgColor = WHITE;
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
See Bear Bibeault's solution in this link.

Consultant, Sima Solutions
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180

This is one of the ways to make alternate colored rows.

<logic:iterate id="displayresult" name="searchuserForm" property="searchresults" >
<td class="tablecolumndark">
<bean:write name="result" property="firstName"/></td>
<td class="tablecolumnlight">
<bean:write name="displayresult" property="lastName"/></td>

The "tablecolumndark" and "tablecolumnlight" can be defined in the css. I think that should work.

SCJP 1.4

Regards,<br />Roshani
I agree. Here's the link: http://aspose.com/file-tools
subject: alternate row color
jQuery in Action, 3rd edition