This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
In "MyServlet.java" it invokes some classes which throws out some special exceptions that can be caught in "MyServlet.java". Then some customized exception (subclass of ServletException) is thrown from "Myservlet.java"'s doGet() and doPost() method. Eventually "MyServlet.java" does "forward(req, res)" to send results to "My.jsp" page, I try to catch ALL the exception in "My.jsp" using "errorpage = ..". But, it seems once the "MyServlet.java" finds any error it goes to a server 500 default page without goes to my special jsp error page. Is it because the exception happened BEFORE the "forward()" ? If so, then how could I make it go to the jsp's special error page ? Thanks, Ian
or may be you can try using web.xml file to mentiond "error-page" element of the DTD and do the stuff .... i've not done it but i guess it should work. because if we set error-page element to be of exception-type and we have appropriate exception defined by you be there in the tag description then when ServletException is thrown, it will first iterate thru error-page directive trying to match the exception and if it can't find a match then it makes a second round to find a match but using getRootCause() method of the ServletException class and hence it should find your custom excepiton which is a subclass of ServletException... regards maulin