Ya, I understand the redirect will create a new request, that is why I also try to use chain result type, but it gave error. Is it a good idea to extend ExceptionMappingInterceptor and build a custom exception interceptor?
Louis ________________________________ From: Wes Wannemacher <w...@wantii.com> To: Struts Users Mailing List <user@struts.apache.org> Sent: Tuesday, August 25, 2009 6:14:43 PM Subject: Re: how to get exception stack after redirect to action The core problem here is that you are redirecting... A redirect generates a whole new request and all of your previous context is lost. I would say find a different way to pass the exception around, but keep in mind that you can run into exception bubbling problems (such as your exception mapping throwing an exception). -Wes On Tue, Aug 25, 2009 at 12:43 PM, Louis Voo<jl...@yahoo.com> wrote: > Hi, > > What I'm trying to do is when exception happen, it redirect to > ExceptionHandlingAction and do something extra like sending email. My > question are > 1) How to get the exception in ExceptionHandlingAction ? I've this setter in > the action public void setException(Exception exception), but nothing is set > 2) How to get the original request? I want to print out all the request > parameters which user submit. > 3) If I use result type "chain" I got this error message: > Infinite recursion detected: > [/exception/exception!execute, > /exception/ExceptionHandling, /exception/ExceptionHandling] > - [unknown location] > > > Here is my configuration: > > <global-results> > <result name="errorAction" type="redirectAction">ExceptionHandling</result> > <result name="error">/WEB-INF/pages/error/Error.jsp</result> > </global-results> > > <global-exception-mappings> > <exception-mapping exception="java.lang.Exception" > result="errorAction" /> > </global-exception-mappings> > <action name="ExceptionHandling" class="demo.action.ExceptionHandlingAction"/> > > > > Thanks > Louis -- Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org