We are building a series of JSP pages, each of which is responsible for producing a different area of the screen.

Bozidar Dangubic

here is what you can do. in the web.xml, define all error pages based on the exceptions and http error codes. you can define a page that gets displayed for each exception that occurs and each http error code (like 500 internal server error or 404 not found). if you do not care about specific exceptions, you can simply define an error page and map it to java.lang.Throwable. if any exception is propagated from the JSP pages or servlets that to be displayed, the container will display an error page over the whole browser. if you have not used error pages in the web.xml yet I suggest that you do since it is a very nice way to prevent stack traces from ever showing on the client screen. error pages are defined as

  Contains a mapping between an error code or exception type to the path of a resource in the web application. 

   The HTTP error code, ex: 404. 

   A Java exception type. 

   The location of the resource in the web application.  

so for example,

when 404 HTTP code is returned, errorPages/404.jsp will be executed and displayed to the client. if NullPointerException is thrown in the resources requested by the client, errorPages/nullPointer.jsp will be executed and displayed to the client. if any other exception that is not caught in your code is thrown, errorPages/generalError.jsp will be displayed...