You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Woods, Jason" <ja...@vignette.com> on 2000/11/08 21:31:58 UTC

getRequestDispatcher() & forward(), Tomcat 3.1

If I have 2 contexts defined as such:

path="" docBase="webapps/ROOT"
path="/second" docBase="webapps/second"

And in the filesystem I have:

webapps/ROOT/controller.jsp
webapps/ROOT/second/hello.jsp
webapps/second/hello.jsp

In controller.jsp I call:

application.getRequestDispatcher("/second/hello.jsp").forward(request,respon
se);

This forwards me to webapps/second/hello.jsp instead of
webapps/ROOT/second/hello.jsp.  However, the ServletContext in use is the
correct one (the same as the controller context). 

I get the same behavior if I use:

request.getRequestDispatcher("second/hello.jsp").forward(request,response);

This doesn't happen if the forward is coming from a context with a path
prefix other than "", so it seems to be a special case bug (possibly in
SimpleMapper) or a feature.  What's up?

Thanks,

- Jason