You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Brian Richards <nc...@pobox.com> on 2001/10/05 03:31:34 UTC

Forward Request alogn with Parameters

I get a null pointer exception at dispatcher.forward()  am i doing something
wrong?

thanks

brian

request.setAttribute("custName",custName);
request.setAttribute("custStreet",custStreet);
request.setAttribute("custZip",custZip);
request.setAttribute("custEmail",custEmail);
request.setAttribute("custCity",custCity);
request.setAttribute("custState",custState);
request.setAttribute("productName",productName);
RequestDispatcher dispatcher =
getServletContext().getRequestDispatcher("vieworder.jsp");
dispatcher.forward(request,response);




Re: Forward Request alogn with Parameters

Posted by simon <si...@lexues.co.jp>.
Just found something in the API docs that might be of help:

getRequestDispatcher
public RequestDispatcher getRequestDispatcher(java.lang.String path)
Returns a RequestDispatcher object that acts as a wrapper for the resource located at the given path. A RequestDispatcher object can
be used to forward a request to the resource or to include the resource in a response. The resource can be dynamic or static.
The pathname must begin with a "/" and is interpreted as relative to the current context root. Use getContext to obtain a
RequestDispatcher for resources in foreign contexts. This method returns null if the ServletContext cannot return a
RequestDispatcher.

Parameters:
path - a String specifying the pathname to the resource
Returns:
a RequestDispatcher object that acts as a wrapper for the resource at the specified path
See Also:
RequestDispatcher, getContext(java.lang.String)


----- Original Message -----
From: "Brian Richards" <nc...@pobox.com>
To: <to...@jakarta.apache.org>
Sent: Friday, October 05, 2001 10:31 AM
Subject: Forward Request alogn with Parameters


> I get a null pointer exception at dispatcher.forward()  am i doing something
> wrong?
>
> thanks
>
> brian
>
> request.setAttribute("custName",custName);
> request.setAttribute("custStreet",custStreet);
> request.setAttribute("custZip",custZip);
> request.setAttribute("custEmail",custEmail);
> request.setAttribute("custCity",custCity);
> request.setAttribute("custState",custState);
> request.setAttribute("productName",productName);
> RequestDispatcher dispatcher =
> getServletContext().getRequestDispatcher("vieworder.jsp");
> dispatcher.forward(request,response);
>
>
>
>


Re: Forward Request alogn with Parameters

Posted by Dmitri Colebatch <di...@bigpond.net.au>.
It looks like the request dispatcher isn't being found.  try using
"/vieworder.jsp" or whatever the location relevant to your base is.

cheers
dim

On Thu, 4 Oct 2001, Brian Richards wrote:

> I get a null pointer exception at dispatcher.forward()  am i doing something
> wrong?
> 
> thanks
> 
> brian
> 
> request.setAttribute("custName",custName);
> request.setAttribute("custStreet",custStreet);
> request.setAttribute("custZip",custZip);
> request.setAttribute("custEmail",custEmail);
> request.setAttribute("custCity",custCity);
> request.setAttribute("custState",custState);
> request.setAttribute("productName",productName);
> RequestDispatcher dispatcher =
> getServletContext().getRequestDispatcher("vieworder.jsp");
> dispatcher.forward(request,response);
> 
> 
> 
>