« Oracle and Linux | Main | The most damning statement ever »

March 02, 2005

Even and Odd rows with logic:iterate

Hat tip: Struts mailing list

Assuming you have the following in your .css file/stylesheet section:


.evenrow {background-color: #C2C2C2; }
.oddrow {background-color: #D2D2D2; }

this will do what you want:

 <logic:iterate id="bean" name="bean.collection.key" scope="session"  property="beanList" indexId="index">
    <tr class='<%= index.intValue()%2 == 0 ? "evenrow" : "oddrow" %>' >
           row content here
    </tr>
 </logic:iterate>

Posted by jb at March 2, 2005 03:44 PM

Trackback Pings

TrackBack URL for this entry:
http://www.undefined.com/cgi-bin/mt/mt-tb.cgi/118

Comments

Post a comment




Remember Me?

(you may use HTML tags for style)