Hi,

then you could have this managed by your action class creating
a getter method for your counter.

Maybe something like that:

Action.class:

public void initCounter() {
  this.counter=0;
}

public int getCounter() {
   return counter++;
}


Your JSP:

 <s:if test="counter%2!=0">
   <s:set name="class" value="'rowdark'" />
 </s:if>
 <s:else>
   <s:set name="class" value="'rowlight'" />
 </s:else>
 

Might work :)

Volker




Volker Karlmeier wrote:
> 
> Hi,
> 
> if you are using an s:iterator, you can do that like this:
> 
> <s:iterator id="iteratorId" value="myList" status="status">
> 
> <s:if test="#status.odd">
>   <s:set name="class" value="'rowdark'" />
> </s:if>
> <s:else>
>   <s:set name="class" value="'rowlight'" />
> </s:else>
> 
> <tr class="${class}">
> ...
> </tr>
> </s:iterator>
> 
> Hope that helps....
> 
>  Volker
> 
> 

Thanks for your help but I m not using an iterator in this table.


-- 
View this message in context: 
http://www.nabble.com/-Struts-2--Switching-Color-in-every-row-tp17268950p1727173
4.html
Sent from the Struts - User mailing list archive at Nabble.com.


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

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

Reply via email to