You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Freddy Villalba A." <fv...@pericless.com> on 2004/10/25 18:54:32 UTC
Error handling basics
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Error handling basics
Posted by Bill Siggelkow <bi...@bellsouth.net>.
No worries, Freddy -- in fact, I apologize; I just wasn't reading
careful enough.
I am glad you solved your problem.
-Bill Siggelkow
Freddy Villalba A. wrote:
> 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:fvillalba@pericless.com]
> 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:news@sea.gmane.org]En nombre de Bill Siggelkow
> Enviado el: lunes, 25 de octubre de 2004 19:13
> Para: user@struts.apache.org
> 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: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Error handling basics
Posted by "Freddy Villalba A." <fv...@pericless.com>.
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:fvillalba@pericless.com]
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:news@sea.gmane.org]En nombre de Bill Siggelkow
Enviado el: lunes, 25 de octubre de 2004 19:13
Para: user@struts.apache.org
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Error handling basics
Posted by "Freddy Villalba A." <fv...@pericless.com>.
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:news@sea.gmane.org]En nombre de Bill Siggelkow
Enviado el: lunes, 25 de octubre de 2004 19:13
Para: user@struts.apache.org
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Error handling basics
Posted by Bill Siggelkow <bi...@bellsouth.net>.
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: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org