Dec 7th, 2005, 07:10 AM
multiple forms and views on teh same jsp
I posted a similar post yesterday but didn't get any response and I wanted to make sure I am clear in what I am trying to do. I would liek to know how I could have a jsp page that has multiple forms and tables of data that the form submit on the same jsp. I am currently using the SimpleFormContoller and validator but I don't see how I can accomplish this.
Dec 7th, 2005, 08:03 AM
The easy way to have one controller produce one form's worth of data and yet still have more than one form on each page sent to the browser (ie one HTML page, possibly >1 JSPs) is to use a templating system in your view layer. I use Tiles for this but I'm sure that you could choose from other technologies such as Webwork or Tapestry, but I haven't used them and can't comment.
I'm not about to go into how to do that in Tiles, but hope that the nod in a right direction helps.
Dec 7th, 2005, 08:38 AM
I'm still new at this too, so I may be wrong, but here's what I've learned experimenting with something similar.
First, if you have mutliple forms on a page, you'll only get pre-processing for one form. So pick one form controller, and to do the pre-processing for all your forms there.
You'll probably need to override referenceData in your pre-processiong
Since you can only bind one command, and chances are each form will need it's own object, you might want to look into placing your objects in a wrapper bean.
Once you get the display down, the submits are normal... each goes to it's own controller. Or, you could look into MultiActionController (I haven't used it yet)... it's supposed to be similar to a struts dispatch action.