webtier@glassfish.java.net

What is the recommended way to catch exceptions and display an error page?

From: <webtier_at_javadesktop.org>
Date: Fri, 29 Jan 2010 03:18:27 PST

Just wondering what the recommended way is to catch any uncaught exceptions (usually application errors, but maybe Faces ones as well) and direct the user to a custom error page, one which I can control the content of?

I'm using 2.0.2. I know things have changed a lot since 1.x but can't find examples for 2.0. I've tried using the error page inside web.xml, but it never gets hit. I've tried writing a filter on the FacesServlet, but the exception never seems to bubble up. I can see ExceptionHandler and ExceptionQueueEvent but can't think of a way to tie it all together.

Quite simply I'd like an error page (preferably a Faces page) to display part of the error for me, and display a code (which I'll be logging so it can be cross-referenced later).

Any ideas?

Thanks,

Ian
[Message sent by forum member 'hirowla' (pd74745_at_police.wa.gov.au)]

http://forums.java.net/jive/thread.jspa?messageID=383649