This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

difference in behaviour of requestDispatcher.forward() in WAS5.0 and WAS6.1

 
ketaki gujarathi
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
In my servlet I am having following peice of code

try{

servletContext = getServletContext();
requestDispatcher = servletContext.getRequestDispatcher(jSPName);//valid jspName path n everythin is fine
requestDispatcher.forward(request, response);
System.out.println("servlet2");
}
catch {

System.out.println("Error Ocurred");


}
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic