tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From paul marshal <>
Subject Re: RequestDispatcher.forward() problem
Date Wed, 21 Feb 2001 15:48:26 GMT
Andrew Kerr wrote:
> Hello,
> I've been having a bit of trouble with the RequestDispatcher.forward()
> method.  If I try to forward to a URL with a query string on it, and
> then have some code that processes the forwarded request, the
> getQueryString() method does not return the query string.  However, the
> parameters _are_ available via getParameter().
> Section 8.1.1 of the Servlet 2.2 spec does not explicitly state what the
> getQueryString() method should return in the event of a forward, but it
> seems to me that if the new request parameters are added to the
> request's internal list of parameters, that it only makes sense to also
> add the parameters to the query string.
> Section 8.4 of the spec states that "the path elements of the request
> object reflect those of the original request."  Although a query string
> is not strictly considered a "path element" according to the spec, it
> does seem in the spirit of section 8.4 that the additional parameters
> should be on the query string.
> Does anyone have any thoughts on this?
> Thanks,
> Andrew

Hi !

I can't answer your exact question. 
But for many purposes - other than reusing an existing servlet class
that you forward to - 

request.setAttribute("name" , valueObject) ; 
RequestDispatcher dest = context.getRequestDispatcher("..."); 

will do. 

Paul Marshall

View raw message