This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Five Lines of Code and have Christian Clausen on-line!
See this thread for details.
Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

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

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