In 1.2.7 you simply change the ActionErrors to ActionMessages. you still save the errors with the saveErrors method and it works the same in the tags.

Inactive hide details for "Gaet" <[EMAIL PROTECTED]>"Gaet" <[EMAIL PROTECTED]>


          "Gaet" <[EMAIL PROTECTED]>

          06/30/2005 04:54 AM

          Please respond to
          "Struts Users Mailing List" <user@struts.apache.org>

To

"Mailing List Struts" <user@struts.apache.org>

cc


Subject

Exception - General Question

Hi everybody,

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

----------------------------------------------------------------------------
----------------
   ActionErrors errors = new ActionErrors();
   try{
   ......
   ......

   } catch (Exception e) {
   //Put print stack trace in System.err so it is logged
   e.printStackTrace(System.err);
   //
   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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Reply via email to