Exception Handling with Spring and Log4J
How to log exceptions. This technique will log messages to your server log file, send an email, with the tag stack of the error, for error level warnings and display a generic page to the user.
First step is to set up Log4j.
Make sure you have the following classes in application lib or common server lib.
activation.jar
This can be got from http://java.sun.com/products/javabeans/jaf/downloads/index.html
Set up your log4J configuration file, put this file in your WEB-INF directory
The traditional way to integrate JSF and Spring was to define JSF beans in faces-config as managed beans and refer to the spring beans using the managed-property configuration. With the help of the spring’s delegatingvariableresolver the managed property is resolved from spring application context and JSF’s IOC injects the bean to the JSF Managed bean instance. I’ve written an article it about this way before.First approach is modelled as follows