Brian:

The below code is exactly how I do and it works peachy for me.

You're just telling Struts to handle any exceptions thrown from an Action by
forwarding the request to /appError.jsp, and using the system.error message
for the page. Good way to handle generic errors that aren't caught somewhere
else in your Actions, in my view.

dave

> -----Original Message-----
> From: Brian McSweeney [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, August 27, 2003 5:49 AM
> To: 'Struts Users Mailing List'
> Subject: RE: how to handle unknown exceptions/errors
>
>
> I dug a bit deeper into this and found that in struts-1.1
> there's a global-exceptions facility in struts-config.xml
> Where you can declaratively handle exceptions for example:
>
> <global-exceptions>
>    <exception key="system.error"
>       type="java.lang.Exception"
>       path="/appError.jsp"/>
> </global-exceptions>
>
>
> But I'm still a bit confused. Would people recommend using
> this?
>
> How do you folks handle system exceptions?
>
> Cheers,
> Brian
>
> -----Original Message-----
> From: Brian McSweeney [mailto:[EMAIL PROTECTED]
> Sent: 26 August 2003 12:50
> To: 'Struts Users Mailing List'
> Subject: how to handle unknown exceptions/errors
>
> Hi all,
>
> Is there a standard way to handle all unknown exceptions in
> Struts?
>
> For example in my Action classes I normally
> Catch specific exceptions and forward to specific error pages.
>
> But for all other exceptions should I just forward to a global
> Errors page?
>
> Eg:
>
> In my struts action
>
>
> public class MyAction extends BaseAction
> {
>     //~ Methods
> ----------------------------------------------------------------
>
>     protected ActionForward doExecute( ActionMapping       mapping,
>                                        ActionForm          form,
>                                        HttpServletRequest  request,
>                                        HttpServletResponse response )
>     {
>       // do stuff
>
>       catch(SpecificException se){
>             forward to specific error page
> }
>
>       catch(Exception e){
>             forward to global error page
> }
>
>     }
> }
>
> Is this how it generally works?
>
> Cheers,
> Brian
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to