File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Struts and the fly likes html:multibox Retrieving values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "html:multibox Retrieving values" Watch "html:multibox Retrieving values" New topic

html:multibox Retrieving values

Ian Cox

Joined: Feb 11, 2008
Posts: 9

I see there are lots of posts on the html:multibox tag but I am struggling to locate one that solves this particular issue.

I have a struts form where all is well apart from I do not get the selections from the multibox when the form is submitted. The form class is as follows

And the jsp has the following to draw up the multibox

Having arranged for the element with ID of 4 to be checked I can see that the get bit is working correct as that checkbox is selected however I never get into the setSelectedItems.

Also, I do get the postcode field back its just the check box information.

What am I doing wrong please?
Merrill Higginson
Ranch Hand

Joined: Feb 15, 2005
Posts: 4864
The problem is in your setSelectedList method. You can't just cast a String array to a List. The java.util.Arrays object has an asList method that comes in handy in these situations. Example:

[ February 20, 2008: Message edited by: Merrill Higginson ]

Consultant, Sima Solutions
Ian Cox

Joined: Feb 11, 2008
Posts: 9
Many thanks,

Fixed that and now everything links up correctly.

I had been led astray by some stuff on the google trail but it must have been work arounds for old issues and no longer applies.

I agree. Here's the link:
subject: html:multibox Retrieving values
It's not a secret anymore!