You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by bu...@apache.org on 2002/11/21 22:26:37 UTC

DO NOT REPLY [Bug 14749] New: - Action "input" not starting with '/' and not a valid forward will cause an internal server error

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14749>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14749

Action "input" not starting with '/' and not a valid forward will cause an internal server error

           Summary: Action "input" not starting with '/' and not a valid
                    forward will cause an internal server error
           Product: Struts
           Version: 1.1 Beta 2
          Platform: All
        OS/Version: Other
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Controller
        AssignedTo: struts-dev@jakarta.apache.org
        ReportedBy: bugzilla@mx4k.com


hi there,

im just getting started with struts but [through newbie configuration error]
i accidently found a "bug". it causes an internal server error from tomcat
displaying a long stack trace and i had a pretty hard time finding out what
was wrong.

here is the snippet from my struts-config.xml

[snip]
  <action path="/register"
   type="my.package.RegisterAction"
   name="registrationForm"
   scope="request"
   input="registration">

   <forward name="success" path="/index.jsp" />
   <forward name="failure" path="/register.jsp"/>
  </action>
[/snip]

here is the validate method from my Form:

[snip]
 public ActionErrors validate(ActionMapping mapping, HttpServletRequest
request)
 {
  ActionErrors errors = new ActionErrors();
  errors.add("very.bad.error", new ActionError("very.bad.error"));
  return errors;
 }
[/snip]

i hardcoded this error cause i wanted to find out how everything works
within struts.

now the process was the following .. i go load a brower point it to the form
fill all fields and press submit.
the struts-internals pretty soon reaches the "processValidate" method from
"RequestProcessor". where we find the following case (NOTE: "input" is
"registration" here!")

[snip]
        // Has an input form been specified for this mapping?
        String input = mapping.getInput();
        if (input == null)
        {
            ...
        }

        request.setAttribute(Action.ERROR_KEY, errors);
        String uri = null;
        if (appConfig.getControllerConfig().getInputForward()) {
            ForwardConfig forward = mapping.findForward(input);
            processForwardConfig( request, response, forward);
        } else {
            internalModuleRelativeForward(input, request, response);
        }
[/snip]

as there is no forward configured by name "registration" he does an internal
redirect which ends at the "doForward" method calling

[snip]
    RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
[/snip]

uri in that case is "registration" and we have an exception cause
"getRequestDispatcher" wants a path starting with '/'.

dunno where to fix that but IMHO either the digester should check wether
"input" is a valid forward or starts with "/".

dunno if this was a known issue, just thought i better let u know cause this
would really have driven me mad if i werent into debugging anyways. (and in
the process of learning struts) i know its a configuration error but the i
couldnt find a warning about this issue anywhere in the docs.

thanks & greets

Thomas

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>