tags:

views:

121

answers:

1

I have a JSP page with several forms on it. Some of these forms are generated dynamically, and each of them submits some information to a database.

Handling one form is easy, as I can simply make the form post to itself, and handle the data using a single bean. Since I have multiple forms, I now have a problem. Several of the forms on the page handle the same type of data (same input names), and a 'setproperty *' call for each of the form beans would change data in several beasn, not just the form/bean that sent the data.

I am attempting to write a separate JSP with a single bean that handles a form submission. However, I'm not sure how to make this page go back to the referring page from which the data was submitted.

i'm going to reformulate in a simple way my question : I have one jsp, that lists an faq with one question and multiple answers. Each answer has its comment form, so its the same formbean.

I dont know how to set this...

A: 

Use a servlet to control, preprocess and postprocess the request based on the request parameters. You can distinguish the form by the name and/or value of the submit button pressed. You can forward the request back to the JSP page by RequestDispatcher#forward().

BalusC