Of course! I forgot that each form has its own action url. Thanks Pierre.
- Mark
-----Original Message-----
From: Pierre Métras [mailto:[EMAIL PROTECTED]]
Sent: Monday, December 11, 2000 11:29 AM
To: [EMAIL PROTECTED]
Subject: Re: multiple forms on an input page
Hi Mark,
> How do you handle the situation where I have multiple forms on one input
> page?
>
> The docs are geared toward a one-to-one relationship between form and form
> bean. I also saw a suggestion on handling cases where a form spans
multiple
> pages.
>
> Is it necessarily bad practice to combine multiple forms on a page? I
> probably could avoid it but I'm sure I've seen systems that do this so I
> want to know how you can deal with it using Struts.
Why should multiple forms on a single page be a problem with Struts? You can
put all the forms you want in a page, even if the common use is a one-one
relationship.
(1) Either they refer to different actions, and you have code like the
following:
<html>
<form:form name="form1" action="action1.do"
type="my.app.actionForm1">
... form1
</form>
<form:form name="form2" action="action2.do"
type="my.app.actionForm2">
... form2
</form>
</html>
with a corresponding struts-config.xml to manage the two actions, eventually
returning back to the same page to let the user select the other action:
<action path="/action1"
type="my.app.actionForm1"
name="form1">
<forward name="result" path="/thePage.jsp" />
</action>
<action path="/action2"
type="my.app.actionForm2"
name="form1">
<forward name="result" path="/thePage.jsp" />
</action>
(2) Either they refer to the same action, and the previous case is seen as a
particular case...
Pierre Métras