Hi there!

 

I was just wondering what is considered to be correct behavior. I’m including a jsp from a servlet (see codesnip below). Now, sometimes the included jsp does not exist. I was under the impression that a ServletException was to be thrown in these cases. This seems to be correct with tomcat 4.0.1. Later, I switched to resin-2.0.0 and to my surprise resin didn’t raise an exception but instead served the error page that I specified in my web.xml for http 404 errors.

 

Now, what is considered to be correct behavior? I’ve checked the specifications but I can’t find anything to indicate the correct behavior.

 

<code-snip>

try {
  RequestDispatcher rd = request.getRequestDispatcher(aURL);
  rd.include(request, response);
} catch (Exception se) {
    CAT.debug("ServletException: " + se);
}

</code-snip>

 

<web.xml>

  <error-page>

    <error-code>404</error-code>

    <location>/404.jsp</location>

  <error-page>

</web.xml>

 

In tomcat 4.0.1 the catch block is reached and the debugging code is executed. Seems to me that the included request does not go through tomcat like a regular request. If it was, tomcat should have redirected the include request to the error page as specified in web.xml.

 

In resin 2.0.0 the catch block is NOT reached. In this case the request seems to go through resin like a regular request, resulting a resin picking up the error page as specified in web.xml.

 

 

_________________________________________________

Inception vof
J.C.H. (Ron) van Pol
PO Box 80
5600 AB Eindhoven
De Zaale 11
5612 AJ Eindhoven
The Netherlands

phone: +31 40 23 90 530
fax: +31 40 23 90 800
mobile: +31 6 28 942 465

 

Reply via email to