JSF is such a new technology that very few best practices for debugging and error handling have emerged yet, but let's look at some possibilities.
Because JSF lends itself to a design where application logic is implemented as plain Java classes, all the usual techniques—such as Java debuggers and JUnit test cases—can be used for a large part of the application.
A JSF application is also a servlet-based application, so truly exceptional runtime exceptions can be trapped and handled by error handlers declared in the web.xml file:
<web-xml> ... <error-page> <exception-type>java.lang.Throwable</exception-type> <location>/errorpage.jsp</location> </error-page> ... </web-xml>
<exception-type> element that names an
exception type and a
<location> element with
a context-relative path for the resource to invoke if the exception
is thrown by any request. The resource can be a JSP page or servlet
that displays a friendly message instead of the stack trace most web
containers show by default. It can also log information about the
error, available as request scope attributes as well as through the
pageContext variable in a JSP page. If you need to deal with different types of exceptions in different ways, you can declare more than one error handler. The web container picks the one with an exception type that most closely matches ...