struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mathew, Manoj" <Mathew.Ma...@principal.com>
Subject RE: Is there a nice ExceptionHandler mechanism in struts for Throwable?
Date Wed, 24 Sep 2003 13:39:09 GMT
Hi

  I am handling it myself in my project..All my action throws exception and i have this in
my struts config.
<!-- ========== Exception Processing Configuration ====================== -->
	<global-exceptions>
		<exception key="systemError" type="java.lang.Exception" handler="com.vv.bb.bb.nn.mm.MyExceptionHandler"
/>
	</global-exceptions>


then in  MyExceptionHandler.java,


public class MyExceptionHandler extends org.apache.struts.action.ExceptionHandler {

public ActionForward execute(Exception ex, org.apache.struts.config.ExceptionConfig ae, org.apache.struts.action.ActionMapping
mapping, org.apache.struts.action.ActionForm formInstance, javax.servlet.http.HttpServletRequest
request, javax.servlet.http.HttpServletResponse response) throws javax.servlet.ServletException
{

...you code to handle it....

.....
}}

hope this will help you..
If anybody has a better way please let us know.
manoj



-----Original Message-----
From: Craig R. McClanahan [mailto:craigmcc@apache.org]
Sent: Tuesday, September 23, 2003 7:41 PM
To: Struts Users Mailing List
Subject: Re: Is there a nice ExceptionHandler mechanism in struts for
Throwable?


Alex Shneyderman wrote:

>I have looked at ExceptionHnadlers and find them pretty nifty.
>Is there a way to do similar thingy with Throwables?
>
>I tried to set ExceptionHandler to catch (type attribute) 
>Java.lang.Throwable but it does not work and I get the ugly
>ServletException as my page to the user?
>  
>
Although it would have been possible to design the existing mechanism to 
support Throwables, it's generally considered bad form to try to deal 
with them -- after all, it's things like OutOfMemoryError and the like, 
and it is not normally something a webapp can recover from.  Are there 
particular Throwables that are not Exceptions that you are interested in 
dealing with yourself?

>Thanks,
>Alex.
>
Craig



---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: struts-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: struts-user-help@jakarta.apache.org


Mime
View raw message