Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with Struts html:select

 
Ted Herrlich
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • 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
 
Vicky Vijay
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
  • 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
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic