Some ideas ......

1. Implement a switching accessor method in a base action form, the idea
is that each time you access the property it will return the value which
was not returned on the prior invocation e.g. 

    // In your base action form
    private String listRowClass;

    public String getListRowClass() {
        if ( "odd".equals(listRowClass)
            listRowClass = "even";
        else
            listRowClass = "odd";

        return listRowClass;
    }

    <%-- In your JSP --%>
    <TR class="<bean:write name="yourForm" property="listRowClass"/>">

2. Use the current index number exposed by logic:iterate, if it is an
even number (e.g. divisible by 2 with no remainder) then use the "even"
style otherwise use the "odd" style. It might be possible to do the mod
calculation using a JSTL tag, if not it should be a trivial matter to
write a custom tag to do it for you.

3. Use a widget such as display tag and let that do all the work for you
:-)


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Sent: 09 June 2005 13:01
To: user@struts.apache.org
Subject: Toggle Colors between Rows



What is the best way to toggle colors between rows using logic:iterate 
keeping in mind the View (MVC....no scriptlets!!) best practice.?

Amitava Basak
ASE
Tata Consultancy Services Limited
Mailto: [EMAIL PROTECTED]
Website: http://www.tcs.com

Notice: The information contained in this e-mail message and/or
attachments to it may contain confidential or privileged information.
If you are not the intended recipient, any dissemination, use, review,
distribution, printing or copying of the information contained in this
e-mail message and/or attachments to it are strictly prohibited.   If
you have received this communication in error, please notify us by reply
e-mail or telephone and immediately and permanently delete the message
and any attachments.  Thank you
--------------------------------------------------------

If you are not an intended recipient of this e-mail, please notify the sender, 
delete it and do not read, act upon, print, disclose, copy, retain or 
redistribute it. Click here for important additional terms relating to this 
e-mail.     http://www.ml.com/email_terms/
--------------------------------------------------------

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to