I'm sure I'll get to this in my project.  Why not make it a read property of
the bean?

        protected String rowColor = "#FFFFFF" ;
        public String getRowColor ( ) { return this.rowColor ; }
        public void setRowColor ( String value ) { this.rowColor = value ; }

Then all you need is a way to change that value at the top of the
<logic:iterate> block by detecting the current state with a couple
<logic:equal> tag.


Anthony

-----Original Message-----
From: Ted Husted [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, April 18, 2001 1:07 PM
To: [EMAIL PROTECTED]
Subject: Re: How to display odd/even rows using iterator


I like Christine's answer better, but here's a simple solution using
(ugh) a scriptlet. 

<tr>
<% int i = 0; %>
<logic:iterate id="lot" name="rows" >
<% i++; if ( i % 2 == 0) { %>
<tr bgcolor="#EEEEEE">
<% } else { %>
<tr bgcolor="#FFFFFF">
<% } %>
    <td> { columns } </td>
  </tr>
</logic:iterate>

What I would really like to see (before I write it myself) is code for
using iterate as a pager. The hooks seem to be there.

-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/

Reply via email to