You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Nani Jon <na...@yahoo.com> on 2002/09/10 18:02:39 UTC
alternating row colors in the iterate tag.
Hi all:
Is there a way to alternate row background colors within an <logic:iterate ....> tag? I was able to do it using java scriplet. The problem is the value of the varaible rowColor shows up on the JSP. Here is a snippet of the code in the JSP page:
<html>
......
<%
String rowColor = "#ffffff";
String prevColor = "#ffffff";
String nextColor = "#ffffcc";
%>
.......
.......
<logic:iterate id="instance" name="main" property="mainInfo.titleCollection" type="com.acs.backend.dao.MusicDAO">
<tr bgcolor=<%=rowColor%>>
<td><......></td>
</tr>
<% if (rowColor == prevColor) { %>
<%=rowColor = nextColor%>
<% } else { %>
<%=rowColor=prevColor%>
<% } %>
</logic:iterate>
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes