• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts combo box

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, Actionform accept only string arrays not collecion or arraylists...but why?
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Makes sense, Merrill. Thanks!!
reply
    Bookmark Topic Watch Topic
  • New Topic