This doesn't work unless e.getMessage() returns a String that is an entry in
your ApplicationResources.properties file.  I did something similar but
added an entry in the ApplicationResources.properties file like 
error.exception = "Exception: {0}". 
 
Then when I create the error I use 
catch (Exception e) {
            ActionErrors errors = new ActionErrors();
            errors.add(ActionErrors.GLOBAL_ERROR, new
ActionError("error.exception", e.getMessage()));
            saveErrors(request, errors);
            return mapping.findForward("failure");
}

And you need to save the errors.

Kim MacKellar

-----Original Message-----
From: Shawn Sohl [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, August 14, 2001 12:52 PM
To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
Subject: findForward and Errors


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
                  

Reply via email to