users@javaserverfaces.java.net

Re: Proper way to configure error page

From: Adam Brod <ABrod_at_intralinks.com>
Date: Thu, 17 May 2007 13:54:02 -0400

I'm using Weblogic 9.1.

From what I can tell, the problem happens because
ResponseStateManagerImpl.isPostback(...) thinks that a server-side forward
to /error.faces is a post-back because the request contains the key
ResponseStateManager.VIEW_STATE_PARAM.(line 120)

Because this request is detected as a postback, RestoreViewPhase.execute()
enters a block of code that restores the previous view (line 138). This
causes FacesServlet to execute the previous view before rendering
error.faces.

Thanks a lot for your help. Feel free to shoot me an offline email if I
can help you reproduce this error or to better explain the problem.

Adam Brod
Product Development Team




From:
Ryan Lubke <Ryan.Lubke_at_Sun.COM>
To:
users_at_javaserverfaces.dev.java.net
Date:
05/17/2007 01:26 PM
Subject:
Re: Proper way to configure error page


Adam Brod wrote:
>
> Hi-
>
> We want to setup an error that will be shown anytime an exception
> bubbles up from the backend. Ideally, I would like to use a
> JSF/Facelets page so that I can have a nice look and feel, reusing our
> existing templates.
>
> Right now, I have configured our web.xml with the standard error page:
>
> <error-page>
> <exception-type>java.lang.Throwable</exception-type>
> <location>/error/error.faces</location>
> </error-page>
>
> I'm trying to avoid a redirect, but I'm having trouble.
>
> When I load error.faces by typing it into the browser, it works fine.
> When I get an exception during the RENDER phase, the error page works
> fine. However, when I encounter an exception on any page (say
> docList.faces) during the INVOKE_APPLICATION phase, I get some odd
> behavior. Basically, even though the servlet container is forwarding
> to error.faces, JSF tries to restore view and go through all the
> phases on docList.faces again before rendering error.faces. So the
> same exception is thrown during the second execution of
> INVOKE_APPLICATION and the error page is never displayed.
Out of curiousity, which container?

Just off the cuff though, I'd agree that it's odd that docList.faces
goes through restoration after the forward
to the error page. I'll reproduce locally on GF and see what happens.
>
> Do I have to use a redirect? Is there a more standard way to display
> an error page?
> *
> Adam Brod*/
> Product Development Team/
> Disclaimer: This electronic mail and any attachments are confidential
and may be privileged. If you are not the intended recipient, please
notify the sender immediately by replying to this email, and destroy all
copies of this email and any attachments. Thank you.
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe_at_javaserverfaces.dev.java.net
For additional commands, e-mail: users-help_at_javaserverfaces.dev.java.net



Disclaimer: This electronic mail and any attachments are confidential and may be privileged. If you are not the intended recipient, please notify the sender immediately by replying to this email, and destroy all copies of this email and any attachments. Thank you.