Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
  • 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

Struts 1 - Multibox Question

 
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

I'm trying find a way to have a more robust mapping of multibox data from a jsp page to a struts form. My question is, is the multibox tag bound specifically to a String Array in the struts form? Or could I use something like a map, or list, etc...something that is a bit more dynamic?

For example...if my multibox is bound to a property in my form called "selectedThings," does "selectedThings" have to be a String[]?

Thanks!
 
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Bryan, this struts API link says that it takes only primitive array types may be not Maps..
 
bryan nelson
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yeah, that limits the robustness a bit.

As a solution I simply created a String[] inside one of my beans which was a field in the form. Although it added a layer of complexity when linking the specific checkbox with the specific String[] in each bean, it works well.

Crisis averted.
 
Shankar Tanikella
Ranch Hand
Posts: 329
Eclipse IDE Oracle Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Finally it is done, may be you can have a wrapper/generic class (since ther is no more upgrade to the struts version (1.x) being used) like formHelper which would help you for other similiar scenarios in future as well..

Anyways, its good to be closed
 
reply
    Bookmark Topic Watch Topic
  • New Topic