If you just want to alternate within the loop you can do something like
this
<logic:iterate id="item" name="list" indexId="index">
<%=index%>
</logic:iterate>
This will print 'index'. So you can do something like this
if( index % 2 == 0 ){
// Do something
} else if( index % 2 == 1 ){
// Do something
}
You might also use the logic:equal tag instead of scriptlets.
Mohan
-----Original Message-----
From: Mick Knutson [mailto:[EMAIL PROTECTED]
Sent: Friday, September 12, 2003 8:06 PM
To: Struts Users Mailing List
Subject: Re: assigning a value back to a bean in a logic:iterate?
I am basically trying to take cellColor which is a variable in my DynaForm,
and loop through an array of alerts[] that is also in this DynaForm. So I
can then alternate the cell colors of the table. So alertForm.cellColor need
to be changed each iteration of this loop.
---
Thanks
Mick Knutson
http://www.baselogic.com
+001(805) 563-0666 Office
+001 (708) 570-2772 Fax
---
----- Original Message -----
From: "Mohan Radhakrishnan" <[EMAIL PROTECTED]>
To: "'Struts Users Mailing List'" <[EMAIL PROTECTED]>
Sent: Friday, September 12, 2003 7:33 AM
Subject: RE: assigning a value back to a bean in a logic:iterate?
>
> <bean:parameter id="cellColor" name="cellColor"
> value="content_tbl_blue" />
>
>
> This code defines a scripting variable but I think that since you don't
have
> any html controls this value is not automatically sent with the request.
>
> In our JSP's where we don't have html controls we use the following code.
>
> <logic:iterate id="timeSheetItem" name="timeSheetEntryForm"
> property="timeSheetItems">
> <bean:write name="timeSheetItem" property="tuesdayTime" />
> <html:hidden name="timeSheetItem" property="tuesdayTime"/>
> </logic:iterate>
> Mohan
>
> -----Original Message-----
> From: Mick Knutson [mailto:[EMAIL PROTECTED]
> Sent: Friday, September 12, 2003 7:44 PM
> To: struts
> Subject: assigning a value back to a bean in a logic:iterate?
>
>
> I have the following code I want to make work:
>
> <logic:iterate id="alert" name="alertListForm" property="userAlerts">
> ................................stuff................................
> <logic:equal name="alertListForm" property="cellColor"
> value="content_tbl_white" >
> <bean:parameter id="cellColor" name="cellColor"
> value="content_tbl_blue" />
> </logic:equal>
> <logic:equal name="alertListForm" property="cellColor"
> value="content_tbl_blue" >
> <bean:parameter id="cellColor" name="cellColor"
> value="content_tbl_white" />
> test blue
> </logic:equal>
> </logic:iterate>
>
> But I can't seem assign "cellColor" attribute back into alertListForm.
>
> ---
> Thanks
> Mick Knutson
> http://www.baselogic.com
>
> +001(805) 563-0666 Office
> +001 (708) 570-2772 Fax
> ---
>
> ---------------------------------------------------------------------
> 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]
>
>
---------------------------------------------------------------------
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]