myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gerald Müllan" <bierbra...@gmail.com>
Subject Re: Navigation in response to an Exception
Date Mon, 25 Sep 2006 14:40:52 GMT
Hi,

what about catching the exception in the action method (i suppose an
action method here)
and giving a different outcome back?

If you would use spring, it would be lot more easy to handle
exceptions. You can define an
exception interceptor which you hang in each call of a model method and respond
to it in an adequately manner.

cheers,

Gerald

On 9/25/06, Lindholm, Greg <glindholm@neom.com> wrote:
> (Once more, any help or suggests?)
>
> -----Original Message-----
>
> I would like to be able to navigate in response to an exception.
>
> I have been able to beat my app into going to an error page when I
> throw a FacesException but that's all, I haven't been able to
> figure out any other navigation cases in response to any other
> type of exception.
>
> I'm trying to find out if there is a better way of dealing with
> exceptions and navigation?
>
> Here is how I have error page navigation working:
>
> - In the web.xml add this:
> <error-page>
>   <exception-type>javax.faces.FacesException</exception-type>
>   <location>/redirectToError.jsp</location>
> </error-page>
>
> Note: /redirectToError.jsp is an intermediate page that redirects you
> back into the FacesServlet since you can't seem to get there directly
> from <error-page>.
>
> - In redirectToError.jsp I save the error info in the session then
> do a redirect to /faces/Error.jsp
>
>  <c:set var="errorMsg" scope="session"
>         value="${requestScope['javax.servlet.error.message']}"/>
>  <c:set var="errorUri" scope="session"
>         value="${requestScope['javax.servlet.forward.request_uri']}" />
>  <c:set var="errorException" scope="session"
>         value="${requestScope['javax.servlet.error.exception']}"/>
>  <c:redirect url="/faces/Error.jsp" />
>
> So far this seems to work. (but if there is a better way I would like
> to here it.)
>
> Now for the problem:
>
> I have another exception condition where I would like to navigate the
> user to a different page (not the error page.) But I always seem
> to end up at the Error.jsp page with a FacesException.
>
> Issues:
> 1) exception can happen during any phase
> 2) any exception seems to get wrapped in a FacesException
> 3) in the render phase faces seems to keep trying after the first
> exception (generating additional exceptions and burying the first
> one I'm really interested in).
> Unless the first one is an AbortProcessingException, but then I can't
> see how to navigate on it.
>
> I've tried changing my Exception type by extending RuntimeException,
> FacesException, and Error and adding additional <error-page> entries
> in the web.xml but I always seem to end up at the Error.jsp page
> (I think due to issue 2 or 3).
>
> Any help or suggests?
>
> Using: MyFaces and Tomahawk 1.1.4 with jsp (not facelets).
>
>
>
>
>


-- 
http://www.irian.at

Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German

Professional Support for Apache MyFaces

Mime
View raw message