You do not need an ActionForm. You can read straight from the form parameters in your
action class as you mentioned.
Pete
Bill Firestone wrote:
> I have hit upon the same problem as this thread, but I didn't see a resolution.
>
> It seems that in Struts 1.0, there must be an ActionForm for every page that has a
>form in it -- or, indeed, an ActionForm for every form, including one for each form
>on a page.
>
> I had thought that I could have an Action class that would read the FORM parameters
>directly, but that I would not need an ActionForm for each screen.
>
> (One of the goals for Struts 1.1 seems to address this.)
>
> Is the above correct, or am I missing something?
>
> Thanks.
>
> Bill Firestone
>
> At 03:09 PM 4/30/2001 +0530, Tewathia, Atul wrote:
> >I feel there is some problem.
> >I tried the same thing but I get the following error on console. It shows
> >that it is trying to instantiate a form bean corresponding to an action
> >mapping. And if i am not specifying one it gives an error. How do I handle
> >this situation when I don't need a form ???
> >
> >OneForm instantiated
> >TwoaeForm instantiated
> >TwokeyForm instantiated
> ><Apr 13, 2001 2:54:59 PM GMT+05:30> <Error> <HTTP>
> ><[WebAppServletContext(446938
> >,threeoseven)] Root cause of ServletException
> >javax.servlet.jsp.JspException: Cannot retrieve definition for form bean
> >null
> > at org.apache.struts.taglib.html.FormTag.lookup(FormTag.java:725)
> > at
> >org.apache.struts.taglib.html.FormTag.doStartTag(FormTag.java:441)
> > at jsp_servlet._two._jspService(_two.java:345)
> > at weblogic.servlet.jsp.JspBase.service(JspBase.java:27)
> > at
> >weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubIm
> >
> >the config.xml used by me is here ...
> >
> ><struts-config>
> > <form-beans>
> > <form-bean name="oneForm" type="org.apache.struts.myprog.OneForm"/>
> > <form-bean name="twokeyForm"
> >type="org.apache.struts.myprog.TwokeyForm"/>
> > <form-bean name="twoaeForm" type="org.apache.struts.myprog.TwoaeForm"/>
> > </form-beans>
> > <action-mappings>
> > <action path="/One" type="org.apache.struts.myprog.OneAction"
> >name="oneForm">
> > <forward name="Two" path="/Two.jsp" />
> > </action>
> > <action path="/Twoae" type="org.apache.struts.myprog.TwoAction"
> >name="twoaeForm">
> > <forward name="Three" path="/Three.jsp" />
> > </action>
> > <action path="/Twokey" type="org.apache.struts.myprog.TwoAction"
> >name="twokeyForm">
> > <forward name="Three" path="/Three.jsp" />
> > </action>
> > <action path="/Twoprev" type="org.apache.struts.myprog.TwoAction">
> > <forward name="One" path="/One.jsp" />
> > </action>
> > </action-mappings>
> ></struts-config>
> >
> >
> >-----Original Message-----
> >From: Tobias Meyer [mailto:[EMAIL PROTECTED]]
> >Sent: Wednesday, April 18, 2001 4:17 PM
> >To: [EMAIL PROTECTED]
> >Subject: RE: No ActionForm Bean Required
> >
> >
> >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