Look at the <html:multibox> tag.
David Gaulin Tel / tél :(613) 946-9595 Email / courriel : [EMAIL PROTECTED] Facsimile / télécopieur : (613) 954-6012 Industry Canada | 235 Queen Street, Ottawa, Ontario, K1A 0H5 Industry Canada | 235, rue Queen, Ottawa (Ontario) K1A 0H5 -----Original Message----- From: Kevin J. Turner [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 12:30 PM To: Struts Users Mailing List Subject: Multiple checkboxes with the same name -- possible with Struts? Is it possible, using the Struts framework, to have multiple checkboxes that are named the same but have different values? First, a little background on this: Say you have the following four fruity checkboxes on a form, with Apple and Mango checked: [x] Apple [ ] Kiwi [x] Mango [ ] Banana Each checkbox has the same html *name* property of "fruit", but they all have different html "value" properties (Apple, Kiwi, etc). In order to get those from the request you would need to do something like this: String[] fruit = request.getParameterValues("fruit"); If you just do a request.getParameter("fruit") with the above scenario, then you'll only get one string back, "Apple" (because its the first one selected). So the problem is, where Struts is concerned, is this: Request-scoped Form beans, behind the scenes, do a request.getParameter() to set the bean values, correct? But when there are multiple form fields with the same name, the getParameter() won't do, Struts needs to call request.getParameterValues(). I'm assuming its not smart enough to do this? (Or is it doing this and I'm just doing something wrong?) To counter this problem, in my Action classes associated with the form bean, I grab values from the request object using getParameterValues(), and store them into a String array. Then I call my setter method, passing in the array. In other words, I call the setter manually, not automatically by Struts. Is there another workaround for this or is this my only option? -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]> -- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>