You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Preston CRAWFORD <Pr...@state.or.us> on 2005/10/03 22:47:45 UTC

Getting at exceptions in Action Classes when forwarded fromweb.xml?

I'm trying to setup global exception handling. I have web.xml sending
404 and 500 exceptions to /error.do. In that action I should be able to
get at the exception, shouldn't I? Or do I have to do that earlier in
the process? I simply want to get at the exception and log it.

Preston

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


Re: Getting at exceptions in Action Classes when forwarded fromweb.xml?

Posted by "Frank W. Zammetti" <fz...@omnytex.com>.
What version of Struts are you using?  Have a look at this:

http://struts.apache.org/userGuide/building_controller.html#exception_handler

That's probably the way you want to go, might save you some trouble. 
I'm not sure when it was introduced though, so if your a ways behind in 
Struts version it might not be available.

Frank

Adam Hardy wrote:
> Preston CRAWFORD on 03/10/05 21:47, wrote:
> 
>> I'm trying to setup global exception handling. I have web.xml sending
>> 404 and 500 exceptions to /error.do. In that action I should be able to
>> get at the exception, shouldn't I? Or do I have to do that earlier in
>> the process? I simply want to get at the exception and log it.
>>
> 
> I don't think you can. The response object is write-only, so there is no 
> way to tell.
> 
> I might be grossly mistaken but I guess you would have to have seperate 
> error-pages for each type of exception. Haven't tried it myself but will 
> need to soon.
> 
> Adam
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 
> 
> 

-- 
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM: fzammetti
Yahoo: fzammetti
MSN: fzammetti@hotmail.com

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


Re: Getting at exceptions in Action Classes when forwarded fromweb.xml?

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Preston CRAWFORD on 03/10/05 21:47, wrote:
> I'm trying to setup global exception handling. I have web.xml sending
> 404 and 500 exceptions to /error.do. In that action I should be able to
> get at the exception, shouldn't I? Or do I have to do that earlier in
> the process? I simply want to get at the exception and log it.
> 

I don't think you can. The response object is write-only, so there is no 
way to tell.

I might be grossly mistaken but I guess you would have to have seperate 
error-pages for each type of exception. Haven't tried it myself but will 
need to soon.

Adam

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