struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gaet" <>
Subject Exception - General Question
Date Thu, 30 Jun 2005 08:54:52 GMT
Hi everybody,

Up to now, I was handling my exceptions in my Action class as follow :

    ActionErrors errors = new ActionErrors();

    } catch (Exception e) {
    //Put print stack trace in System.err so it is logged
    errors.add(ActionErrors.GLOBAL_ERROR, new
ActionMessage("errors.keyDescribingError : "+e.getMessage()));
    saveErrors(request, errors);
    // Forward control to the appropriate error page
    forward = mapping.findForward("erreur");

However ActionErrors is now deprecated so I'm wondering if using
ActionMessages instead is well appropriate.????

I have seen that a common use is to define an ExceptionHandler....seems to
be nice as we just handke the errors in one place but :
    - It seems that using ExceptionHandler we lost the finest degree of the
exception and we have not a personnalized message for the exception thrown.
       Of course, we could do a catch in the Action class and throw the
exception with the personalized messaged but then I have another question :
            - Does ExceptionHandler slower than catching the exception in
each Action class?

Finally, What is the best practice to handle exceptions in struts?

Thanks in advance for your help

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message