Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts combo box

 
starts singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, Actionform accept only string arrays not collecion or arraylists...but why?
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
starts singh
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Makes sense, Merrill. Thanks!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic