As I understand it, the flow is:
1. User hits submit button to submit against an Action, e.g., /logon in your
example
2. This is actually redirected to and handled by ActionServlet
3. ActionServlet instantiates/finds LogonForm instance
4. ActionServlet populates LogonForm from "same named" parameters from POST
5. ActionServlet calls validate() method of LogonForm (if validate=true in
<action> tag)
6. If ActionErrors returned by validate() is non-null and non-empty,
ActionServlet forwards to input= attribute of action definition, which is
"/logon.jsp" for you, and errors are displayed
7. If there are no errors, ActionServlet instantiates/finds LogonAction and
calls perform() method of LogonAction
8. LogonAction returns ActionForward
9. ActionServlet forwards to ActionForward returned
That said, I'm not sure what your problem is, since I don't recall getting
that exact exception. What is "jasper"? Is that basically a "page not
found" error for apache? Do you have JSPs configured, that is, can you hit
JSP pages directly? Otherwise, forwarding to "/logon.jsp" would not work.
I've also had some situations where I needed to have the input attribute be
set to something like "/logon.do" because I needed to do some setup before
displaying errors. That was when I was initially trying to convert an app
to use struts, so I'm not so sure I needed to do it or that it was a good
idea, but you might try that.
Good luck,
Scott
> -----Original Message-----
> From: Roxie Rochat [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, April 24, 2001 5:50 PM
> To: [EMAIL PROTECTED]
> Subject: ActionForwards / validation control flow questions
>
>
> I'm getting a javax.servlet.ServletException
> at
> org.apache.jasper.runtime.PageContextImpl.handlePageException(
> PageContextImp
> l.java:449)
> when I try to do validation, so I went back to the basic
> struts example
> and tried to dissect it. I've ended up being even more confused about
> how control flow and ActionForwards work and would appreciate
> some enlightenment about the conclusions I've drawn.
>
> When I run the logon.jsp page and click submit without typing
> anything in, LogonForm.validate() returns errors and
> LogonAction is never instantiated. Somehow, magically,
> the logon.jsp page is re-displayed with the errors.
>
> If LogonForm.validate() is modified so that it does not add
> any errors,
> LogonAction is instantiated. It can find the "success"
> forward, but not
> the forward for mapping.getInput():
>
> System.out.println("success forward = " +
> mapping.findForward("success"));
> System.out.println("mapping.getInput() = " +
> mapping.getInput());
> System.out.println("input forward = " + new
> ActionForward(mapping.getInput()));
>
> results in:
> success forward = ActionForward[success]
> mapping.getInput() = /logon.jsp
> input forward = ActionForward[null]
>
> Again, even if there are errors, the logon.jsp page is re-displayed.
>
> my struts-config.xml:
> <global-forwards><forward name="success"
> path="/logon.jsp"/></global-forwards>
> <action-mappings>
> <action path="/logon"
> type="org.apache.struts.webapp.example.LogonAction"
> name="logonForm" scope="request"
> input="/logon.jsp">
> </action>
> </action-mappings>
>
> So, if the form returns errors, its associated jsp page automatically
> displayed again?
>
> Why can't ActionForward(mapping.getInput()) find the path? Or is this
> ActionForward[null] just a misleading artifact? [I can't
> get Forte for
> Java
> configured to debug and I'm tired of printlns. I sure hope
> VAJava3.5.3 works
> soon.]
>
> Thanks in advance,
> Roxie
>