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
<error-page> Contains a mapping between an error code or exception type to the path of a resource in the web application. <error-code>theErrorCodeNumber</error-code> The HTTP error code, ex: 404. <exception-type>java.exception.TypeOfException</exception-type> A Java exception type. <location>path/to/resource</location> The location of the resource in the web application.so for example,
<error-page> <error-code>404</error-code> <location>errorPages/404.jsp</location> </error-page> <error-page> <exception-type>java.lang.NullPointerException</exception-type> <location>errorPages/nullPointer.jsp</location> </error-page> <error-page> <exception-type>java.lang.Throwable</exception-type> <location>errorPages/generalError.jsp</location> </error-page>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...