You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Roxie Rochat <rr...@journee.com> on 2001/04/25 02:50:20 UTC

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