Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

html:multibox Retrieving values  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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?
Ian
 
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Ian Cox
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Ian
 
please buy this thing and then I get a fat cut of the action:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!