This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes Struts and the fly likes Multi check boxes error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multi check boxes error" Watch "Multi check boxes error" New topic
Author

Multi check boxes error

Simpson Kumar
Ranch Hand

Joined: Mar 19, 2008
Posts: 261
hi, I have jsp page with multiple check boxes, I can retrieve values and displayed them in table. that means each row contains one check box, one bean:write property, and two text fields(empty).

in the next step, when after I selected some text fields, the corresponding property and two text field values should come into Action.

I tried with the following code -- JSP



Java (FormBean)



When After I selected them and clicked next..
Im getting the following exception


Thanks,
Kumar
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem is with the property selectedTools. You've made it of type List, but the only type Struts will allow in a multi-value input is String[]. Change the type to String[] and it should work.

Also, I think it's a bit odd to try and stuff so many values into the multibox value attribute. I'd suggest just using the id value, and then looking up the rest of the values in the Action class to which the form is submitted, either by doing a database call, or by looking up the value in a session-scoped List or HashMap.


Merrill
Consultant, Sima Solutions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Multi check boxes error