You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Sharma, Sanjay (LNG)" <Sa...@lexisnexis.com> on 2002/06/24 23:24:48 UTC

Handling multiple forms on a page

Consider the following scenario:

I have a JSP (A) with two forms. Form B and Form C.
Form B maps to Action B and forwards to JSP B. 
Form C maps to Action C and creates to JSP C.

On JSP B, I want to have an HREF that takes me back to Page A with entries
for Form B preserved.
On JSP C, I want to have an HREF that takes me back to Page A with entries
for Form C preserved.

I have two alternatives:
1) Define 2 actions A1, and A2. Associate Form Bean B with A1 and Form Bean
C with A2. On JSP B, use action A1 and on JSPC use action A2. I have to
define two actions just to associate the right Form Bean with them.

2) If I wish to use one action( Action A) , the action will have to create
Form Bean B or C from the request parameters and add it to request/session
scope, so that the appropriate form gets populated.

Both approaches feel kludgey. I prefer the second one.

Any comments or better solutions?


Sanjay

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>