why not use JSTL <c:forEach.....? :) ----- Original Message ----- From: "Ryan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, November 27, 2003 12:31 AM Subject: Checkbox and Map ActionForm
> I have checkboxes on my form that have multiple options/group. > The name for each group of checkboxes is generated from the database, so > I decided to use a map on my action form to collect the checkbox values > since the names of the checkbox are not known. > > However, when more than one option is selected within a group, BeanUtils > turns the array passed from the checkbox into the first value of the array. > > For example, if for box1 1,3,4 are selected, box1's value in the map is 1. > > Is there a way to collect the values submitted by a checkbox group > without knowing the name of this group beforehand? > > Thanks > Ryan > > > > The html form: > > <html:form action="/setMethods" scope="request"> > <html:checkbox property="value(box1)" value="1"/>1 > <html:checkbox property="value(box1)" value="2"/>2 > <html:checkbox property="value(box1)" value="3"/>3 > <html:checkbox property="value(box1)" value="4"/>4 > <html:checkbox property="value(box1)" value="5"/>5 > <br><br> > <html:checkbox property="value(box2)" value="a"/>a > <html:checkbox property="value(box2)" value="b"/>b > <html:checkbox property="value(box2)" value="c"/>c > <br> > <input type="submit"> > </html:form> > > The action form > > public class FooForm extends ActionForm { > > private final Map values = new HashMap(); > > public void setValue(String key, Object value){ > values.put(key, value); > } > public Object getValue(String key){ > return values.get(key); > } > > } > > > > --------------------------------------------------------------------- > 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]