This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In my servlet I am having following peice of code
servletContext = getServletContext();
requestDispatcher = servletContext.getRequestDispatcher(jSPName);//valid jspName path n everythin is fine
For Testing purpose I have removed one "<%" from my jsp file to throw the compilation error.
The following servlet & jsp is present in an EAR n is deployed in WAS6.1 fix pack 31 and also in WAS5.0
Following is the behaviour observed for
1. WAS 5.0
Since der is JSP compilation error , requestDispatcher.forward(req,res) throws an Exception which is caught and System.out.println("Error Ocurred"); is executed
2. WAS 6.1
Since der is JSP compilation error , requestDispatcher.forward(req,res) throws an Exception and System.out.println("servlet2"); is executed . however the exception thrown is not caught and no SOP in catch block is executed
As per my observation WAS5.0 uses servlet specification 2.3 and WAS6.1 uses 2.4
I would like to know why the behaviour is different and what changes needs to be done on either WAS side or in Servlet so that whn forward method throws exception it is caught in the calling method and SOP in catch block is executed.