• 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

Problem with Struts html:select

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am relatively new to Struts and Spring, but I thought I had this worked out logically, but it's not working.

I have a Select Statement that populates based on a bean -- it works fine. It shows the select box with the values selected based on the value of the bean. Hoever when I attempt to submit the form I am getting a type mismatch in the ActionForm.



problemStatementClassificationReferenceArray is a java Set<ClassificationReference>, obviously ClassificationReference is a java class with several attributes including'id' and 'title'. It populates fine, but when I submit it fails with:
java.lang.IllegalArgumentException: Cannot invoke mil.af.igems.ui.web.finding.FindingForm.setProblemStatementClassificationReferenceArray - argument type mismatch

My question is does the Select statement not return based on the type of the 'property' attribute? Is it returning something else, like a String Array?

TIA,
Ted
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ted,

Refer the below link,

http://www.vaannila.com/struts/struts-example/struts-html-select-tag-example-1.html


In Action, you can retrieve the value selected in the drop down,

so the property provided should be string..

for e.g.,




Property should be declared as follows,




Hope this give you an idea to work further.. !
 
Ted Herrlich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply! I seem to be a little confused on something. You can use an object of type 'Collection' in the property attribute of a select statement, which is used to identify the selected items (in this case it is a multiple), but when it comes back from making selection changes, you are returning a String object, so your property attribute needs to reference a String? That seems to defeat the purpose of being able to use a Collection object for the select statement. I feel like I am missing something simple.

I'll read your link and maybe that will help.

Thanks again,
Ted
 
reply
    Bookmark Topic Watch Topic
  • New Topic