This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts 1 - Multibox Question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts 1 - Multibox Question" Watch "Struts 1 - Multibox Question" New topic
Author

Struts 1 - Multibox Question

bryan nelson
Ranch Hand

Joined: Jun 16, 2003
Posts: 95
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!


"...and the Truth will set you free."
Shankar Tanikella
Ranch Hand

Joined: Jan 30, 2011
Posts: 329

Bryan, this struts API link says that it takes only primitive array types may be not Maps..


Have Fun with Java
little,little.. little by little makes a lot..
bryan nelson
Ranch Hand

Joined: Jun 16, 2003
Posts: 95
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

Joined: Jan 30, 2011
Posts: 329

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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Struts 1 - Multibox Question
 
Similar Threads
multibox issue with DynaValidatorForm
Arraylist + multibox
Checkbox/Multibox validation in Struts
Iterator and multibox
multibox , resultSet, logic:iterate