wood burning stoves 2.0*
The moose likes Struts and the fly likes Struts combo box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts combo box" Watch "Struts combo box" New topic
Author

Struts combo box

starts singh
Greenhorn

Joined: Mar 18, 2008
Posts: 3
I have a combo box defined in JSP.
So when I submit the page with multiple values selected in thsi combo box, I get "argument type mismatch exception" for the setter method defined in actionForm for this combo box. This method has a return type "Collection". Where do you think I am going wrong? What should be the return type here? I had String before but with I could get only the one value from the combo box
(i.e first selected value).
starts singh
Greenhorn

Joined: Mar 18, 2008
Posts: 3
Ok, Actionform accept only string arrays not collecion or arraylists...but why?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
Originally posted by starts singh:
Ok, Actionform accept only string arrays not collecion or arraylists...but why?

Because the HTML protocol only deals in Strings, not other Java object types. The Struts ActionForm setter method is taking as it's parameter input from an HTML form. The only type of data an HTML form understands is a String.


Merrill
Consultant, Sima Solutions
starts singh
Greenhorn

Joined: Mar 18, 2008
Posts: 3
Makes sense, Merrill. Thanks!!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts combo box