It may seem odd, but the "name" attribute of the "action" element is
associated with the form bean.  If you change the value from
"shoppingCart" to "ShoppingCartForm" (or vice versa), then they will
match up.

> -----Original Message-----
> From: Stephane Grenier [mailto:[EMAIL PROTECTED] 
> Sent: Thursday, September 11, 2003 1:23 PM
> To: Struts Users Mailing List
> Subject: form is always null in action
> 
> 
> Hello all.
> 
> I can't seem to figure this one out. My form object in my 
> action class is always null. Any help would be greatly 
> appreciated. Here are my settings of importance:
> 
> Struts-config.xml:
> 
> <form-beans>
>     <form-bean name="ShoppingCartForm"      
> type="com.rana.release.forms.ShoppingCartForm" />
> </form-beans>
> 
> <action-mappings>
>  <action path="/ShoppingCartAction"
>   type="com.rana.release.actions.ShoppingCartAction"
>   name="shoppingCart"
>   scope="session">
>   <forward name="success" path="/purchase.jsp"/>
>   <forward name="failure" path="/badTest.jsp"/>
>  </action>
> </action-mappings>
> 
> what I do to get to this page is call the following from a 
> jsp this way:
> 
> <html:link page="/ShoppingCartAction.do" >shopping cart</html:link>
> 
> And the purchase.jsp contains the following:
> 
>    <html:form action="ShoppingCartAction" 
> name="ShoppingCartForm" 
> type="com.rana.release.forms.ShoppingCartForm" scope="session">
>      <html:text property="quantity" /><br>
>      <html:submit>Checkout</html:submit>
>    </html:form>
> 
> For my action, the code is simply:
> ShoppingCartForm shoppingCartForm = (ShoppingCartForm)form;
> 
> System.out.println(form);
> 
> And this results always in a null object. Any help would be 
> greatly appreciated.
> 
> Thanks,
> 
> Stephane
> 
> 
> 
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to