The moose likes Struts and the fly likes form with multibox on several pages Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "form with multibox on several pages " Watch "form with multibox on several pages " New topic

form with multibox on several pages

Mickey O'Rourke

Joined: Sep 20, 2006
Posts: 1

Thanks for taking the time to read my problem. I'm new to the struts framework and have a problem. Here's the situation:

I have a dynamic set of checkboxes being displayed using the multibox tag. The first ten boxes are displayed on page one, the next ten on page two, etc.

The form is declared in a JSP page which uses Tiles to display the page that shows the check boxes. Moving from page to page is done with a link that passes a parameter - the page index - to the action class which displays the desired set of checkboxes.

When the form is submitted, the boxes that were checked are saved into an array in the form-bean automatically by struts. The problem I am having is that if I check a box on page one, then move to page two, the fact that a box on page one was checked is lost and doesn't get put into the array. Only the check boxes on the current page gets saved into the array.

My problem is that I need all the checked checkboxes to be saved into the array. I am not sure if this is enough info but it's a start.

Thanks again for any advice, it's greatly appreciated.
[ September 20, 2006: Message edited by: Mickey O'Rourke ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63873

"G B",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

JavaRanch Sheriff

[Asking smart questions] [About Bear] [Books by Bear]
Brent Sterling
Ranch Hand

Joined: Feb 08, 2006
Posts: 948
The complete solution might be a bit tricky. The basic problem is likely your link. Rather than link directly to another jsp or action, you need to submit your form when the user clicks the link (likely using some JavaScript code). That JavaScript also needs to set a property on your form that indicates what links was clicked so that you can determine what page needs to be shown. Are you saving your from in session scope?

- Brent
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3753

"Mickey O'Rourke"

Please re-read the naming policy on obviously fictitious names and choose a name more appropriate for this forum.


[OCA 8 Book] [Blog]
I agree. Here's the link:
subject: form with multibox on several pages
It's not a secret anymore!