By the way... I was being sarcastic with my last comment, Bill. Second-read
it and thought it could have been offensive / rude.
Thanx again.
-----Mensaje original-----
De: Freddy Villalba A. [mailto:[EMAIL PROTECTED]
Enviado el: lunes, 25 de octubre de 2004 20:01
Para: Struts Users Mailing List
Asunto: RE: Error handling basics
Yes, I did:
input="admin_customers.jsp"
However, I've noticed the problem(s):
- I was missing a "/".
- The MessageResource's file is required.
- I was constructing the ActionError instance using the message itself,
instead of the message key to locate the right message within the
MessageResource's file.
As if u hadn't noticed, it's been a while since I coded some Struts for the
last time...
Thanx everybody,
Freddy.
-----Mensaje original-----
De: news [mailto:[EMAIL PROTECTED] nombre de Bill Siggelkow
Enviado el: lunes, 25 de octubre de 2004 19:13
Para: [EMAIL PROTECTED]
Asunto: Re: Error handling basics
Hmmm... it looks like you *didn't* specify the input attribute on the
mapping.
Freddy Villalba A. wrote:
Hello,
I've made myself a small test application. I wanted to test error handling
within the "validate" method. The problem is that I'm not being redirected
to the jsp I have specified inside the "input" attribute. Instead, I'm
getting a blank page (with no error messages at all inside).
This is the validate method in my form:
public ActionErrors validate(ActionMapping actionMapping,
HttpServletRequest
httpServletRequest) {
ActionErrors errors = new ActionErrors();
if ((this.getName() == null) ||
this.getName().trim().equals("")) {
errors.add(ActionErrors.GLOBAL_ERROR, new ActionError("Must specify
a
name"));
}
if (errors.isEmpty()) {
return null;
} else {
return errors;
}
}
This is the <action> mapping inside my struts-config.xml:
<action input="admin_customers.jsp" name="customerForm"
path="/createCustomer" scope="request"
type="com.xxxxx.sgp.presentation.struts.invoice.CreateCustomerAction"
validate="true">
<forward name="unexpected_error" path="/unexpected_error.jsp"
redirect="true" />
</action>
I'm not using the <message-resources> tag (I believe it's not mandatory to
use one).
Am i missing something?
Thanx,
Freddy.
P.S.: I've debugged the RequestProcessor and it seems to be stopping -
without throwing an exception or anything else - when trying to execute
the
following line:
RequestDispatcher rd = getServletContext().getRequestDispatcher(uri);
and my web application's context root is "wa"
(http://localhost:8080/wa/createCustomer.do)
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]