You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Bill Firestone <bi...@cisco.com> on 2001/06/18 19:26:25 UTC
RE: No ActionForm Bean Required
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:t-g-p@gmx.de]
>Sent: Wednesday, April 18, 2001 4:17 PM
>To: struts-user@jakarta.apache.org
>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
Re: No ActionForm Bean Required
Posted by Scott Fauerbach <sc...@arondight.com>.
Remember that the struts controller is a servlet?
Did you know that
javax.servlet.http.HttpServletRequest
implements
public java.lang.String getParameter(java.lang.String name)
( This is how we used to get the parameters from a form in the olden days.
[last year!] )
The struts perform method:
public ActionForward perform (ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws IOException,
ServletException {
kindly passes the request to you, for just these type of situations.
Personally, I would go through the effort of using the struts forms.
Scott Fauerbach
----- Original Message -----
From: "Bill Firestone" <bi...@cisco.com>
To: <st...@jakarta.apache.org>
Cc: <st...@jakarta.apache.org>
Sent: Monday, June 18, 2001 10:26 AM
Subject: RE: No ActionForm Bean Required
> 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:t-g-p@gmx.de]
> >Sent: Wednesday, April 18, 2001 4:17 PM
> >To: struts-user@jakarta.apache.org
> >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
>
Re: Workflow: Struts inside of Struts
Posted by Dan Connelly <ds...@adelphia.net>.
Craig McC. wrote, concerning attempts to concoct a new scope for workflow across multiple applications:
For the first, the servlet spec is not going to help you much. It has
very little to say about cross-application support. ...... The standard
advice is to use databases or EJBs for data that needs to be available
across web applications.
Not quite. It seems to me that there is at least one other interesting avenue by which a cross-application context may be created: HTML scraping. That is, the Struts Controller (given some chained-in Action parsers) can hook hard data from the data stream of a URL connection. The data comes from a second application. There are no shared databases or EJBs between the two applications. Just some AI-ish good sense in the Action servlet.
Ok, "scraping" idea is crude and ad hoc. But soon we will have the exact technologies, SOAP and Web Services, in widespread use. SOAP will pump hard data, client-server style, over URL connections. Someday, http will be just the obligatory eye candy for the XML-challenged client agent. Yes, the web will have EJBs and SQLs for applications that are explicitly created to share within some narrow realm. However, URLs will rule (as they do now) as the lingua franca.
At any rate, that is the way my workflow project is running. (See old post, below.) The applicaions I want to have running with the workflow do not use a shared database or EJBs. My rules say that I can't change the applications.
In Struts Inside of Struts the browser doesn't invoke the inner app, it gets the Struts Action Controller to do the invocation, using a URL connection. Struts Inside of Struts?? Well, the inner app doesn't really need to be Struts. It just needs to be reasonable HTML text.
Maybe I should just call this approaoch Scraping Inside of Struts. Eventually it could be Soap Inside of Struts.
My WFContext, mentioned below, was a bad idea. The session scope of the outer app works just fine. Or, Ted's Hashtable, if you prefer.
----- Original Message -----
From: Dan Connelly
To: struts-dev@jakarta.apache.org
Sent: Tuesday, June 19, 2001 2:52 AM
Subject: Workflow: Struts inside of Struts
For the sake of our discussion on Struts & Workflow, below is most of an internal company proposal from me to a co-worker concerning a simple Workflow demo. This proposal is drawn, in part, from recent ideas posted to this list. What may be different in what I am suggesting is that Workflow really means the "composition" of existing applications. That is, an application that wraps up some number of existing apps. The "View" might be a Todo list in one window in a frameset spawning links to display in the "main" window of the frameset.. Struts inside of Struts.
Dan Connelly
Keeping [our] Workflow extremely simple at this point, it seems
to me that our next step is to show that we can interpose a
"pre-condition" between two separate, pre-exisiting applications. Also,
that we can wrap the two applications in pre- and post- actions.
We have two interesting applications from Apache running on our Tomcat
server: "Mail Accounts" (aka "example") and "File Upload" (aka
"upload). The default setup for these two applications is to run them
in two separate Web Contexts within the server. Currently, there is no
interaction between these two applications. They are just separate
demonstrations of "Struts," the MVC framework (Release 1.0) from Apache.
I propose that we will now develop a Workflow Context (WFContext) to
require that a user wanting to run "File Upload" must first "login"
through the "Mail Accounts" applications and that there must be listed
a "notification account" among that user's email accounts. This is the
Workflow pre-condition to be demonstrated.
Once this pre-condition is satisfied, then the user may proceed to use
"File Upload" to transfer data. For each file transferred, an email
notification of the upload completion status will be sent to the
designated account. This is the Workflow post-action to be
demonstrated. (There will also be pre-actions, but they will be
hidden.)
The aim here is to subsume two existing applications into a new "Upload
with Mail Workflow" application which will control these apps out of its
own Web Context.
(The Web Context is a server concept, while the WFContext is part of the
Workflow logic framework, unknown to Web server. In a previous email I
described a WFContext as an application specific data structure --
principally a hashtable -- that gradually instantiates unknown data in a
controlled manner.)
Our goal is to utilize the logic of the existing applications without
modification to their Java code or to any existing database. It will
be permitted, however, to modify the code of the Struts framework and to
modify the "struts-config.xml" for both of the affected application.
Despite these changes and despite the new Workflow logic (application),
the two applications should continue to run with unchanged
functionality.
It is assumed that Tomcat's security settings would prevent the direct
use of the two applications once the Workflow became a requirement.
Privileged "LDAP" accounts would continue to have direct access to the
two separate applications.
Workflow: Struts inside of Struts
Posted by Dan Connelly <ds...@adelphia.net>.
For the sake of our discussion on Struts & Workflow, below is most of an internal company proposal from me to a co-worker concerning a simple Workflow demo. This proposal is drawn, in part, from recent ideas posted to this list. What may be different in what I am suggesting is that Workflow really means the "composition" of existing applications. That is, an application that wraps up some number of existing apps. The "View" might be a Todo list in one window in a frameset spawning links to display in the "main" window of the frameset.. Struts inside of Struts.
Dan Connelly
Keeping [our] Workflow extremely simple at this point, it seems
to me that our next step is to show that we can interpose a
"pre-condition" between two separate, pre-exisiting applications. Also,
that we can wrap the two applications in pre- and post- actions.
We have two interesting applications from Apache running on our Tomcat
server: "Mail Accounts" (aka "example") and "File Upload" (aka
"upload). The default setup for these two applications is to run them
in two separate Web Contexts within the server. Currently, there is no
interaction between these two applications. They are just separate
demonstrations of "Struts," the MVC framework (Release 1.0) from Apache.
I propose that we will now develop a Workflow Context (WFContext) to
require that a user wanting to run "File Upload" must first "login"
through the "Mail Accounts" applications and that there must be listed
a "notification account" among that user's email accounts. This is the
Workflow pre-condition to be demonstrated.
Once this pre-condition is satisfied, then the user may proceed to use
"File Upload" to transfer data. For each file transferred, an email
notification of the upload completion status will be sent to the
designated account. This is the Workflow post-action to be
demonstrated. (There will also be pre-actions, but they will be
hidden.)
The aim here is to subsume two existing applications into a new "Upload
with Mail Workflow" application which will control these apps out of its
own Web Context.
(The Web Context is a server concept, while the WFContext is part of the
Workflow logic framework, unknown to Web server. In a previous email I
described a WFContext as an application specific data structure --
principally a hashtable -- that gradually instantiates unknown data in a
controlled manner.)
Our goal is to utilize the logic of the existing applications without
modification to their Java code or to any existing database. It will
be permitted, however, to modify the code of the Struts framework and to
modify the "struts-config.xml" for both of the affected application.
Despite these changes and despite the new Workflow logic (application),
the two applications should continue to run with unchanged
functionality.
It is assumed that Tomcat's security settings would prevent the direct
use of the two applications once the Workflow became a requirement.
Privileged "LDAP" accounts would continue to have direct access to the
two separate applications.
Re: No ActionForm Bean Required
Posted by Bill Firestone <bi...@cisco.com>.
Pete,
You are correct on all counts.
Thanks!
--Bill
At 08:35 AM 6/19/2001 -0500, you wrote:
>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:t-g-p@gmx.de]
>>> >> > > >Sent: Wednesday, April 18, 2001 4:17 PM
>>> >> > > >To: struts-user@jakarta.apache.org
>>> >> > > >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
>>> >> >
>>> >> >
>>> >
apostrophe in an application resource properties file does disappear in the JSP file compiled!!!!!!!!!!!
Posted by Matteo Di Giovinazzo <ma...@infinito.it>.
For example in the struts-blank.jar in the ApplicationResource.properties
there is a key with a value that contains an apostrophe (0x27 ASCII Code):
index.message=[...]Place it in your container's "webapp" folder[...]
In the JSP file that call
<bean:message key="index.message"/>
the apostrophe disappear!! IS THIS A BUG???
Matteo Di Giovinazzo
Re: No ActionForm Bean Required
Posted by Peter Alfors <pe...@irista.com>.
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:t-g-p@gmx.de]
>> >> > > >Sent: Wednesday, April 18, 2001 4:17 PM
>> >> > > >To: struts-user@jakarta.apache.org
>> >> > > >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
>> >> >
>> >> >
>> >
Re: No ActionForm Bean Required
Posted by Bill Firestone <bi...@cisco.com>.
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:t-g-p@gmx.de]
>>>> > >Sent: Wednesday, April 18, 2001 4:17 PM
>>>> > >To: struts-user@jakarta.apache.org
>>>> > >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
>>>>
>>>>
Re: No ActionForm Bean Required
Posted by Peter Alfors <pe...@irista.com>.
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:t-g-p@gmx.de]
>> > > >Sent: Wednesday, April 18, 2001 4:17 PM
>> > > >To: struts-user@jakarta.apache.org
>> > > >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
>> >
>> >
>
Re: No ActionForm Bean Required
Posted by Bill Firestone <bi...@cisco.com>.
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:t-g-p@gmx.de]
>> > >Sent: Wednesday, April 18, 2001 4:17 PM
>> > >To: struts-user@jakarta.apache.org
>> > >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
>>
>>
Re: No ActionForm Bean Required
Posted by "Craig R. McClanahan" <cr...@apache.org>.
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:t-g-p@gmx.de]
> > >Sent: Wednesday, April 18, 2001 4:17 PM
> > >To: struts-user@jakarta.apache.org
> > >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
>
>
Re: No ActionForm Bean Required
Posted by Peter Alfors <pe...@irista.com>.
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:t-g-p@gmx.de]
> >Sent: Wednesday, April 18, 2001 4:17 PM
> >To: struts-user@jakarta.apache.org
> >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
Re: ActionForm Bean and Action class relation
Posted by Ted Husted <hu...@apache.org>.
It might help to explain the circumstances. I'm not sure why you would
start with one ActionForm bean and then switch to another. You may wish
to have one larger ActionForm bean that can be used in both places.
A popular pattern is to use one Action to handle several related tasks,
like all the inserts, selects, updates, and deletes for a given table in
your your database. In this case, it is convenient to use several
different ActionMappings, but have them all use the same Action class
(TYPE=...). An easy way to tell which ActionMapping was used, is to set
the "parameter" property for each.
path= "/package/myAction/Input.do"
type = "package.myAction"
parameter = "this"
validate = false
and
path= "/package/myAction/Insert.do"
type = "package.myAction"
parameter = "that"
validate = true
The mappings are passed to validate(), reset(), and perform(), so in
each case you can tell which task is in use with
String task = mappings.getParameter();
For multipage "wizard" forms, David W's validator has a "page" feature
that helps with that.
< http://home.earthlink.net/~dwinterfeldt/ >
-- Ted Husted, Husted dot Com, Fairport NY USA.
-- Custom Software ~ Technical Services.
-- Tel 716 737-3463.
-- http://www.husted.com/about/struts/
Viplava Nekkalapudi wrote:
>
> Hi,
> I have a small problem in handling the Action form
> beans and Action classes. For every action class, we
> have a request scope action form bean. My action class
> executes before the jsp page displays and it is mapped
> to a form bean. The first time JSP is displayed, my
> form bean properties are null/blank, and the form bean
> will be populated when I submit the jsp page. I need
> to validate form parameters at this time in the second
> action class which has mapped to different form bean
> and jsp page. How to use the same bean between
> requests with request scope? Do I need to use the form
> bean in session scope?
> Do I need to use dfferent action classes for
> different actions on the same page, OR one action
> class? How to handle form beans and action classes
> between multiple pages some data with session scope
> and some with request scope.
>
> Thanks in advance.
>
> __________________________________________________
> Do You Yahoo!?
> Spot the hottest trends in music, movies, and more.
> http://buzz.yahoo.com/
ActionForm Bean and Action class relation
Posted by Viplava Nekkalapudi <vi...@yahoo.com>.
Hi,
I have a small problem in handling the Action form
beans and Action classes. For every action class, we
have a request scope action form bean. My action class
executes before the jsp page displays and it is mapped
to a form bean. The first time JSP is displayed, my
form bean properties are null/blank, and the form bean
will be populated when I submit the jsp page. I need
to validate form parameters at this time in the second
action class which has mapped to different form bean
and jsp page. How to use the same bean between
requests with request scope? Do I need to use the form
bean in session scope?
Do I need to use dfferent action classes for
different actions on the same page, OR one action
class? How to handle form beans and action classes
between multiple pages some data with session scope
and some with request scope.
Thanks in advance.
__________________________________________________
Do You Yahoo!?
Spot the hottest trends in music, movies, and more.
http://buzz.yahoo.com/