| Author |
html:select multiple="true" How to return multiple selections?
|
Jesse J Johnson Jr
Greenhorn
Joined: May 09, 2005
Posts: 2
|
|
I am having trouble returning the "multiple selected" options from a list. When I initially 'submit' the JSP, my list gets populated correctly. The user is then allowed to make multiple selections from the list. After 'submit', the server reports "java.lang.IllegalArgumentException: argument type mismatch". Of course, if I select nothing from the list, the server does not complain. My struts tags... <html:select property="dto.geoRegionNames" multiple="true" size="10"> <html ptionsCollection property="dto.configGeoRegions" label="name" value="name"/> </html:select> On this page, I am displaying a list of states selected from a previous page. After the first 'submit' the user will be allowed to refine her selection from the list displayed. The data type of dto.geoRegionNames is ArrayList. The dto.configGeoRegions is a complex data type. I would like to structure this so that the page sends multiple selections back on submit. Any ideas? Thank you.
|
 |
Merrill Higginson
Ranch Hand
Joined: Feb 15, 2005
Posts: 4864
|
|
|
<html:select> will only support a simple String array, and not an ArrayList. You will have to restructure your code to allow for this limitation. One thing you might do is code a String array as a direct attribute of the form bean, and then when the form is read, have your action class convert the String array to an ArrayList and place it in your Data Transfer Object.
|
Merrill
Consultant, Sima Solutions
|
 |
Jesse J Johnson Jr
Greenhorn
Joined: May 09, 2005
Posts: 2
|
|
|
Merril, thanks for your suggestion. I'll give it a try.
|
 |
 |
|
|
subject: html:select multiple="true" How to return multiple selections?
|
|
|