File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "alternate row color" Watch "alternate row color" New topic
Author

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

thanxs<%
int num = 0;
String SLATE = "#E4E4E4";
String WHITE = "#FFFFFF";
String bgColor = null;
%>

<logic:iterate id="element" name="dateMap">
<%
num++;
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.


Merrill
Consultant, Sima Solutions
RoshaniG Gopal
Ranch Hand

Joined: May 15, 2006
Posts: 180
Hi

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

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

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

Regards,
Roshani
SCJP 1.4


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