[prev in list] [next in list] [prev in thread] [next in thread] 

List:       struts-user
Subject:    Re: Managing exceptions
From:       Joe Germuska <Joe () Germuska ! com>
Date:       2005-04-28 16:23:01
Message-ID: a0621022ebe96bd2bbfc8 () [192 ! 168 ! 2 ! 102]
[Download RAW message or body]

At 5:57 PM +0200 4/28/05, Sébastien GALLET wrote:
>Joe Germuska a écrit :
>
>>At 3:11 PM +0200 4/24/05, Sébastien GALLET wrote:
>>
>>>Hello,
>>>I'm looking for a good way to manage exceptions in struts.
>>>Any links in your bookmarks ?
>>
>>
>>That's a pretty general question!
>
>yes, it was :-[
>With your help, I can catch exceptions in my 
>servlet and display them in my app.
>Is there a way to catch jsp exception (caused by 
>a missing resource for examples) and tiles 
>exception ?

Check out <c:catch> from the JSTL: 
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/c/catch.html

Struts itself doesn't provide any support, 
because the ExceptionHandler which is distributed 
in the core always assumes that its safe to 
forward -- which is illegal once the response is 
committed, as when you have a tiles exception.

I don't think it would be too much work for 
someone to adjust the Struts general exception 
handler so that it tested response.isCommitted() 
and somehow did a request dispatcher include 
instead of returning an ActionForward.  It would 
take a bit of thinking to flush out possible 
wrinkles, but its conceptually pretty simple, 
except for determining how to best configure it.

Joe

-- 
Joe Germuska            
Joe@Germuska.com  
http://blog.germuska.com    
"Narrow minds are weapons made for mass destruction"  -The Ex

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


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic