Meaningless Drivel is fun!
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
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Multi check boxes error" Watch "Multi check boxes error" New topic

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

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.

Consultant, Sima Solutions
I agree. Here's the link:
subject: Multi check boxes error
It's not a secret anymore!