tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Craig R. McClanahan" <>
Subject Re: Problem with getRequestDispatcher
Date Tue, 30 May 2000 21:10:41 GMT
Mike Karl wrote:

> I am trying to forward the request from a Servlet to a JSP using
> getRequestDispatcher.  Tomcat is giving me an error when I try to do
> this:
> ServletContext sc = getServletContext();
> RequestDispatcher rd = sc.getRequestDispatcher("../CustReg.jsp");
> rd.forward(req, res);
> I get:
> java.lang.NullPointerException
>         at CustReg.doPost(

This is happening because getRequestDispatcher() is returning a null.  The reason for that
is you are
specifying an invalid argument -- the path must begin with a slash and be relative to the
context root.

If you want to use a path like this ("../CustReg.jsp") that is relative to the current request,



Craig McClanahan

View raw message