tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Servlet and pathinfo with jsp in Tomcat 3.2
Date Mon, 11 Dec 2000 18:02:30 GMT
"Lipner, Tomas" wrote:

> The below code runs servlet "myservlet" with pathinfo "pages/welcome.jsp".
> <frame NAME="main" SRC="<%= context %>/servlet/myservlet/pages/welcome.jsp"
> It functions correctly with Tomcat 3.1, but Tomcat 3.2 returns error message
> "The page cannot be found".
> Tomcat 3.2 doesn't interpret it as 'myservlet' with path info
> 'pages/welcome.jsp', but wants to open page
> "/servlet/myservlet/pages/welcome.jsp" directly.

It looks like the change to an interceptor version of the invoker broke the
previous ordering of mapping a request URI to a servlet -- now it is picking up
the "*.jsp" match for the JSP servlet before checking for the path match.

Note that the "invoker" concept (/servlet/*) is not part of the servlet
specification, so you are not guaranteed that it will work identically -- or
even be present -- on any given servlet container.  As a portable mechanism to
do what you want, I suggest adding the following to your web.xml file:

        <!-- Change this to the fully qualified class name of your servlet -->


This inserts a path-based mapping back into the way Tomcat works, which occurs
ahead of the extension mapping (due to the rules in the servlet spec).  As an
extra added bonus, you can map this servlet to any URL you like -- it doesn't
have to start with "/servlet/myservlet" if you would prefer something else).

> When I use:
> /servlet/myservlet/servlet/anotherservlet
> it functions correctly, i.e. myservlet is called with path info
> 'servlet/anotherservlet'
> Tomas

Craig McClanahan

View raw message