Hi All,

We ran into a problem with JSP pages under Tomcat 5.5.9 which did not
exist under Tomcat 4.1.31.

In Tomcat 5.5.9 if we forward to a JSP page that is in a different
directory then the initial request the errorPage directive does not work
as we expected.

If we use a path relative errorPage directive then Tomcat 5.5.9 seems to
assume that the errorPage path is relative to the path of the initial
HTTP request not the JSP page.  Is this behavior correct?

For example, Error 404, /servlet/PopError.jsp appears if an HTTP request
of /servlet/PathServ forwards to a JSP page, /popdrv/pathRelative.jsp,
that uses relative paths and then throws an exception.

        <%@ page language="java"
            session="true"
            errorPage="PopError.jsp"
        %>

We found a similar entry in BugZilla which was closed because the
problem could not be reproduced.

http://issues.eu.apache.org/bugzilla/show_bug.cgi?id=35230

One can get the correct errorPage by using a Context relative path.

        <%@ page language="java"
            session="true"
            errorPage="/popdrv/PopError.jsp"
        %>

We have attached 6 files, PathServ.java, pathRelative.jsp,
ContextServ.java, contextRelative.jsp, PopError.jsp, and web.xml.  To
see the issue one can create a context and place PathServ.java in the
directory com.optimedsys.servlet, pathRelative.jsp and PopError.jsp in
the directory popdrv.   To see the workaround one can place
ContextServ.java in the directory com.optimedsys.servlet,
contextRelative.jsp and PopError.jsp in the popdrv directory.

Request "context/servlet/PathServ" to see the 404 error or
"context/servlet/ContextServ" to get the correct errorPage.

Thank You

Lee Breslow
[EMAIL PROTECTED]

Arlene Milgram
[EMAIL PROTECTED]
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
    "http://java.sun.com/dtd/web-app_2_3.dtd";>
<web-app>
	<servlet>
		<servlet-name>PathServ</servlet-name>
		<display-name>Demo use of error directive with error page being relative to the path.</display-name>
		<description>Path Servlet</description>
		<servlet-class>com.optimedsys.servlet.PathServ</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>ContextServ</servlet-name>
		<display-name>Demo use of error directive with error page being relative to the context</display-name>
		<description>Context Servlet</description>
		<servlet-class>com.optimedsys.servlet.ContextServ</servlet-class>
	</servlet>
	<servlet>
		<servlet-name>contextRelative.jsp</servlet-name>
		<display-name>contextRelative</display-name>
		<description>context Relative</description>
		<jsp-file>/popdrv/contextRelative.jsp</jsp-file>
	</servlet>
	<servlet>
		<servlet-name>pathRelative.jsp</servlet-name>
		<display-name>pathRelative</display-name>
		<description>path Relative</description>
		<jsp-file>/popdrv/pathRelative.jsp</jsp-file>
        </servlet>
	<servlet>
		<servlet-name>PopError.jsp</servlet-name>
		<display-name>PopError</display-name>
		<description>PopError</description>
		<jsp-file>/popdrv/PopError.jsp</jsp-file>
	</servlet>
	<servlet-mapping>
		<servlet-name>ContextServ</servlet-name>
		<url-pattern>/servlet/ContextServ</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>PathServ</servlet-name>
		<url-pattern>/servlet/PathServ</url-pattern>
	</servlet-mapping>
</web-app>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to