Take a look at the <html:multibox> tag. I believe this will do what you
want.

--
Martin Cooper


----- Original Message -----
From: "Kilmer, Erich" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, October 02, 2001 12:30 PM
Subject: html:checkbox question


> On my page I want to show checkboxes with text next to it. Each checkbox
> needs a numeric value associated with it. So when someone checks the box I
> get something in the query string like:
> "deliveryoptions=111&deliveryoptions=222".
> Oh yeah, there could be one or more deliveryoptions. They come in a
> collection from my business logic (its in "list").
>
> <%
> Collection list = new ArrayList();
> DeliveryOption do1 = new DeliveryOption("1", "Paper");
> list.add( do1);
> DeliveryOption do2 = new DeliveryOption("2", "Web");
> list.add( do2);
> DeliveryOption do3 = new DeliveryOption("3", "Email");
> list.add( do3);
> request.setAttribute("list", list);
> %>
>
> <logic:iterate id="DeliveryOption" name="list"
> type="com.customers.web.DeliveryOption" >
>    <html:checkbox name="DeliveryOption" property="value"/>
>    <bean:write name="DeliveryOption" property="displayName"/><br>
> </logic:iterate>
>
> Notice in the html:checkbox tag, DeliveryOption is the bean to iterate
over.
> Value is the field name in the bean that I would like to populate the HTML
> input checkbox's value field with.
>
> When I view the source in the browser I see:
>    <input type="checkbox" name="value" value="on">Paper<br>
>    <input type="checkbox" name="value" value="on">Web<br>
>    <input type="checkbox" name="value" value="on">Email<br>
>
> What I would like to see is name="deliveryoptions" in each line and
> value="111", then value="222" then value="333".
>
> How would I do this?
>
> TIA!
>
> Erich Kilmer
> Bell+Howell
> RTP, NC
>
>


Reply via email to