HTML and CSS Reference
In-Depth Information
public CustomExceptionHandlerFactory(ExceptionHandlerFactory parent) {
this.parent = parent;
public ExceptionHandler getExceptionHandler() {
ExceptionHandler result = new CustomExceptionHandler(parent.getExceptionHandler());
return result;
Finally, we need to register the custom exception handler factory class in the faces -config.xml , as shown in
Listing 2-40.
Listing 2-40. Registering the Custom Exception Handler Factory Class in the JSF Configuration File
<?xml version='1.0' encoding='UTF-8'?>
<faces-config version="2.1"
xmlns=" "
xmlns:xsi=" "
web-facesconfig_2_1.xsd " >
<!-- ... -->
After setting up this exception handling mechanism in the firstApplication , if an exception is thrown from the
firstApplication for whatever reason, the error.xhtml page will be displayed as Figure 2-5 .
Figure 2-5. The error handling page (error.xhtml)
the complete source code of the updated firstApplication example is available on the topic web site at (attached in the Chapter 2 source code zip file).
In this chapter, you learned in detail the different ways for declaring, initializing, and managing the dependencies of
the JSF managed beans. You also learned in detail how to make use of the EL in your JSF applications. You now also
know in detail how to efficiently use the JSF navigation system and finally how to utilize the JSF exception handling
mechanism in order to empower your JSF application error handling.
Search WWH ::

Custom Search