aspose file tools*
The moose likes Struts and the fly likes Problem with Struts html:select Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Problem with Struts html:select" Watch "Problem with Struts html:select" New topic
Author

Problem with Struts html:select

Ted Herrlich
Greenhorn

Joined: Feb 22, 2012
Posts: 3
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

Joined: Apr 23, 2008
Posts: 125
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

Joined: Feb 22, 2012
Posts: 3
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
 
Consider Paul's rocket mass heater.
 
subject: Problem with Struts html:select