开发者

Handling multiple forms on a single JSP

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...


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().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜