struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Néstor Boscán <nestor.bos...@tcs.com.ve>
Subject RE: How to use <html:multibox /> with values stored in the request or page context
Date Sun, 14 Aug 2005 23:12:27 GMT
Thanks Wendy

Regards,

Néstor Boscán 

-----Mensaje original-----
De: Wendy Smoak [mailto:java@wendysmoak.com] 
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" <nestor.boscan@tcs.com.ve>

> 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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org




---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message