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: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>