Thanks Wendy

Regards,

Néstor Boscán 

-----Mensaje original-----
De: Wendy Smoak [mailto:[EMAIL PROTECTED] 
Enviado el: Sunday, August 14, 2005 6:08 PM
Para: Struts Users Mailing List
Asunto: Re: How to use <html:multibox /> with values stored in the request
or page context

From: "Néstor Boscán" <[EMAIL PROTECTED]>

> The problem is that in the form bean you only set the values of the 
> <html:multibox /> or <html:checkbox /> that are selected, not all of them.
> So to draw all of them you need to take the values from somewhere 
> else, tipically an object that is in request or session context.

True. :)  Here's an example from one of my projects.  'accountMap' is a Map
of key/value pairs representing cost centers in the accounting system and
their descriptions.  This renders a checkbox for each cost center, and the
framework automatically "checks" the appropriate boxes depending on the
contents of the form bean's "accounts" property (which I think is a String[]
).

<c:forEach items="${accountMap}" var="item" >
   <html-el:multibox property="accounts" value="${item.key}"/>
   <c:out value="${item.key}"/> -
   <c:out value="${item.value.costCenterDesc}"/>
</c:forEach>

--
Wendy Smoak 



---------------------------------------------------------------------
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