How to handle exceptions for Java web applications