I use multiple forms successfully in my sample application that I did in the
Wrox Pro JSP 2nd Edition book. There is one per entry in the HTML table.
--- snip: from showshoppingcart.jsp ----
<html:form action="/checkout.do">
<html:hidden property="action" value="update" />
<html:hidden property="<%= Constants.TITLE_ID %>"
value="<%= String.valueOf(titleId) %>" />
<table cellspacing="2" cellpadding="2" border="0">
<tr>
<td>
<bean:define id="quantity" name="cartItem" property="quantity"/>
<html:text property="quantity"
value="<%= String.valueOf(quantity) %>"
size="5" maxlength="5"/>
</td>
<td>
<html:submit>
<bean:message key="button.update"/>
</html:submit>
</td>
</tr>
</table>
</html:form>
--- snip: from showshoppingcart.jsp ----
I iterate over a collection of items in the shopping cart and display the
table. NOTE, each form has it's own submit button and that I use a hidden
variable to tell which form was submitted.
Here is the struts-config.xml file entry:
--- snip: from struts-config.xml file ----
<!-- Process checkout request -->
<action path="/checkout"
type="com.wrox.pjsp2.struts.shopping.CheckoutAction"
name="checkoutForm"
scope="request"
validate="false">
<forward name="success" path="/shoppingcart.jsp"/>
</action>
--- snip: from struts-config.xml file ----
Hopes this helps...
Source code from my chapter example can be downloaded from:
http://www.newparticles.com/struts
There is a new version being placed on the site that is based on the CVS
snapshot from December. It's in the read me. I will be updating this in
the next month or so to be current with CVS.
Thanks,
Steve Wilkinson
>From: "Rustad, Aaron" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
>Subject: Multiple Forms on one JSP...
>Date: Wed, 6 Feb 2002 13:15:53 -0700
>
>
>I seem to be running into a bit of a problem with one of my JSP pages that
>has two forms on it. Only one Form is being instantiated for it. I am sure
>you should be able to have multiple forms.
>
>Here is an example of my JSP:
>
><html:form action="/searchFood" >
>
><table width="224" border="0">
>
> ** FORM CODE **
>
></html:form>
><html:form action="/selectFood">
>
> ** MORE FORM CODE **
>
> </html:form>
>
>However, only the Form bean associated with "/searchFood" is instantiated
>and placed in the session.
>
>Here is the entries I have in the struts-config.xml
>
> <action path="/searchFood"
> type="com.anassina.web.nutrition.SearchFoodAction"
> name="searchForm"
> scope="session"
> validate="false">
> <forward name="success" path="/nutrition/SearchFood.jsp"/>
> </action>
>
> <!-- Add selected Food -->
> <action path="/selectFood"
> type="com.anassina.web.nutrition.SelectFoodAction"
> name="selectedFoodForm"
> scope="session"
> validate="false">
> <forward name="success"
>path="/nutrition/FoodGroupList.jsp"/>
> </action>
>
>I would think that struts should handle this correctly.
>I am not receiving any errors with the exception of the JSP reference to
>the
>second bean isn't being found.
>
>
>Please advise.
>Thanks!
>Aaron.
>
>
>
>--
>To unsubscribe, e-mail:
><mailto:[EMAIL PROTECTED]>
>For additional commands, e-mail:
><mailto:[EMAIL PROTECTED]>
>
_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>