html:select multiple="true" How to return multiple selections?
Jesse J Johnson Jr
Joined: May 09, 2005
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.
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?
Joined: Feb 15, 2005
<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.