• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

html:multibox Retrieving values

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Die Fledermaus does not fear such a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic