struts-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shawn Sohl <>
Subject RE: findForward and Errors
Date Tue, 14 Aug 2001 21:01:48 GMT
	Thanks for your reply.  I have tested the code in the logonAction
class it does work.  However, it only works when you use a "key" in the
properties file.  If I have this code in a "catch" statement, how can I use
the actual error message with the "getMessage()" method of the exception
class?   Any ideas on how to get around this?


-----Original Message-----
From: Craig R. McClanahan []
Sent: Tuesday, August 14, 2001 1:20 PM
To: ''
Cc: ''
Subject: Re: findForward and Errors

On Tue, 14 Aug 2001, Shawn Sohl wrote:

> In my Action class I catch errors if they occur.  What I want to know is
> I create an "ActionErrors" object within my Action class and add an error
> it like I do in a Form class.  Basically what I want to do is shown in the
> code below.  My .jsp page that "failure" points to has the
> tag within it but it isnt picking up the error.  I know I can create and
> an attribute within the response object and pass the error that way but I
> thought I could use something like I'm trying to do below.
>  catch(Exception e)
>                 {
> 	        ActionErrors errors = new ActionErrors();
>                     errors.add("error",new ActionError(e.getMessage());
>                     return mapping.findForward("failure");
>                 }
> Thanks

The Struts example application does something very similar to this in
LogonAction -- since that is where an invalid username/pasword combination
is detected.  I think this is a reasonable design approach.


View raw message