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


Reply via email to