Leo Neumeyer wrote:
> I read many postings from people having problems using
> getServletContext().getRequestDispatcher(targetPage).forward(req, res);
>
> The problem seems to be that relative references in the target page will
> not work because the base path is the original servlet path and not
> the path of the target page. (Am I right?)
>
> Has anybody found a way to get forward() to work with static or JSP pages
> that contain relative references?
>
> I'm using JRun with its builtin web server on Windows.
>
I can't speak for JRun in particular, having not used it, but you might want to
read the API documentation for ServletContext.getRequestDispatcher() , quoted
below in part:
The pathname must be in the form "/dir/dir/file.ext".
In other words, relative references are not legal accodring to the spec, and it is
within the rights of the servlet engine to return null to a
ServletContext.getRequestDispatcher() call with a relative path, or to throw an
IllegalArgumentException.
If you specify a correct pathname, it is interpreted as relative to the context
path for the servlet context in which you are operating. See the "Clarifications
to the Servlet API 2.1 Specification" in the JSP 1.0 spec for more information on
this.
Craig McClanahan
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html