Craig,
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?
Thanks
-----Original Message-----
From: Craig R. McClanahan [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 1:20 PM
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
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
can
> I create an "ActionErrors" object within my Action class and add an error
to
> 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
"<html:errors/>"
> tag within it but it isnt picking up the error. I know I can create and
set
> 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.
Craig