Andy, 

try this:

<c:forEach var="service" items="${services}" varStatus="status">>
   <TR>
     <TD><c:out value="${service.name}"/></TD>
     <TD><html:multibox property="selectedServices[${status.index}]"><c:out 
value="${service.status}"/></html:multibox></TD>
   </TR>
</c:forEach>

If the selectedServices is an array of Strings in your form, 
and service.status == selectedServices[n], then the the checkbox
should be checked or atleast the tag should render the appropriate
HTML such that the checkbox should be checked.

I believe the problem is that the selectedServices is an indexed property.
If your container support JSP2.0 spec, then the above should work. If not,
then you will have to use the equivalent Struts-EL tag.

I think you see most examples using <logic:iterate .../> because it supports
and "indexed hook" into indexed tags by setting its indexed attribute to true.
But the whole indexed property thing is hard to get your head around. 

This link may give you some more insight.
http://struts.apache.org/faqs/indexedprops.html

hth

robert

BTW, the above code has not been tested.
If your selectedServices array is not the same length as your services 
ArrayList,
then things are going to get ugly.




> -----Original Message-----
> From: andy wix [mailto:[EMAIL PROTECTED]
> Sent: Monday, November 15, 2004 9:34 AM
> To: [EMAIL PROTECTED]
> Subject: Use JSTL with html:multibox tag
> 
> 
> Hi,
> 
> All the examples I've seen of using the above tag use the logic:iterate tag 
> to output to the page.
> Does anyone have an example of how to this with JSTL?
> 
> My attempt is:
> 
> <c:forEach var="service" items="${services}" varStatus="status">
>   <TR>
>     <TD><c:out value="${service.name}"/></TD>
>     <TD><html:multibox 
> value="${service.status}"property="selectedServices"></html:multibox></TD>
>   </TR>
> </c:forEach>
> 
> where services is an ArrayList in session with all available services and 
> selectedServices is the array of Strings in my form class.
> 
> The above displays all the values in services correctly but doesn't exhibit 
> any interaction between the checkboxes on the page and the selectedServices 
> array.
> 
> Thanks,
> Andy
> 
> _________________________________________________________________
> Get ready for school! Find articles, homework help and more in the Back to 
> School Guide! http://special.msn.com/network/04backtoschool.armx
> 
> 
> ---------------------------------------------------------------------
> 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