Are you using the html:form tag?
It looks as though that tag requires that you have a bean associated
with the form.
I am using struts 1.0 beta 3 (so maybe this is different in the 1.0
release) but, the form tag
trys to retrieve a bean from the pageContext, if it does not find one,
then it attempts to create a new one.
So it looks like you will either need to add a bean, or use a standard
<FORM> tag.
However, using the <FORM> HTML tag will forfeit the bonus stuff craig
mentioned below.

HTH,
    Pete


Bill Firestone wrote:

>  Pete,
>
> I thank you, but I still get "Cannot retrieve definition for form bean
> null."  XML now is:
>
>     <action path="/uidstart"
>             type="com.cisco.nm.uid.struts.action.UidAction">
>        <forward name="success" path="/engineresult.jsp"/>
>     </action>
>
> I'm sure I'm modifying correct XML file because if I add
>
>     name="FRED"
>
> attribute in <action> element, then the above error turns into "Cannot
> retrieve definition for form bean FRED"
>
> Bill
>
> At 03:33 PM 6/18/2001 -0500, you wrote:
>
>> try removing the 'scope' and 'validate' attributes.
>>
>> Pete
>>
>>
>>
>> Bill Firestone wrote:
>>
>> >  All sounds good, but I get the following error:
>> >
>> > Error: 500
>> > Location: /uid/index.jsp
>> > Internal Servlet Error:
>> > javax.servlet.ServletException: Cannot retrieve definition for form
>> > bean null
>> > at
>> > 
>org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:459)
>> >
>> > at
>> > 
>_0002findex_0002ejspindex_jsp_34._jspService(_0002findex_0002ejspindex_jsp_34.java:257)
>> >
>> > at
>> > org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
>> >
>> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> > at
>> > 
>org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:177)
>> >
>> > at
>> > org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:318)
>> >
>> > at
>> > org.apache.jasper.servlet.JspServlet.service(JspServlet.java:391)
>> > at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>> > at
>> > org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
>> >
>> > at org.apache.tomcat.core.Handler.service(Handler.java:286)
>> > at
>> > org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
>> >
>> > at
>> > org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
>> >
>> > at
>> > org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
>> >
>> > at
>> > 
>org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
>> >
>> > at
>> > org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
>> >
>> > at
>> > org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
>> >
>> > at java.lang.Thread.run(Thread.java:484)
>> > Root cause:
>> > <same as above>
>> >
>> > struts-config.xml has:
>> >     <action    path="/uidstart"
>> >                type="com.cisco.nm.uid.struts.action.UidAction"
>> >                scope="request"
>> >                validate="false">
>> >     <forward name="success"              path="/engineresult.jsp"/>
>> >
>> >     </action>
>> >
>> > Bill
>> >
>> > At 11:00 AM 6/18/2001 -0700, Craig R. McClanahan wrote:
>> >
>> >
>> >
>> >>  On Mon, 18 Jun 2001, Peter Alfors wrote:
>> >>
>> >>  > You do not need an ActionForm.  You can read straight from the
>> >>  form
>> >>  > parameters in your action class as you mentioned.
>> >>  >
>> >>
>> >>  Yes, you can definitely do this.  Of course, you give up the
>> >>  automatic
>> >>  stuff that Struts does for you (calling reset(), populating the
>> >>  properties, and calling validate()) in this case.
>> >>
>> >>  > Pete
>> >>  >
>> >>
>> >>  Craig
>> >>
>> >>
>> >>  >
>> >>  > 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
>> >>  >
>> >>  >
>> >

Reply via email to