You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Stanley Tan <st...@crosswinds.net> on 2001/04/17 11:42:43 UTC
No ActionForm Bean Required
Hi all,
Let's say I have a link that allows a user to empty his/her shopping
cart. The link to empty the cart points to "/empty.do". I do not believe
this requires an ActionForm bean (PLEASE, correct me if I am
wrong). Nonetheless, I have specified an ActionForm Bean because it is
required:
<action path="/empty"
type="EmptyAction"
name="buyBean"
scope="request">
<forward name="success" path="/viewcart.jsp"/>
</action>
The bean is NOT used and has nothing to do with emptying the shopping
cart. Do I just accept that it works? Or am I designing the program
wrong? Please help.
Thanks in advance,
Stanley Tan
RE: No ActionForm Bean Required
Posted by Tobias Meyer <t-...@gmx.de>.
Hi Stanley,
> Let's say I have a link that allows a user to empty his/her shopping
> cart. The link to empty the cart points to "/empty.do". I
> do not believe
> this requires an ActionForm bean (PLEASE, correct me if I am
> wrong). Nonetheless, I have specified an ActionForm Bean
> because it is
> required:
>
> <action path="/empty"
> type="EmptyAction"
> name="buyBean"
> scope="request">
> <forward name="success" path="/viewcart.jsp"/>
> </action>
>
> The bean is NOT used and has nothing to do with emptying the shopping
> cart. Do I just accept that it works? Or am I designing the program
> wrong? Please help.
You don't have to specifiy an ActionForm if you don't need one.
Watch the LogoffAction in the example shipped with struts:
<!-- Process a user logoff -->
<action path="/logoff"
type="org.apache.struts.example.LogoffAction">
<forward name="success" path="/index.jsp"/>
</action>
Hope this helps,
Tobias Meyer