tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeff Kilbride" <j...@kilbride.com>
Subject Re: Wrap an HttpServletRequest
Date Wed, 14 Nov 2001 23:21:17 GMT
Hi Diego,

You can also do this by adding query string data to the URL you are
forwarding to, for example:

---------
String myPage = "/path/myPage.jsp";
String myForward = myPage + "?newParam1=value1&newParam2=value2";

RequestDispatcher rd = getServletContext().getRequestDispatcher(myForward);
rd.forward(request, response);
---------

This way, your new info is added to the request as additional query string
data. Your existing JSP pages can access the info with the normal
request.getParameter() calls. They don't have to know that the request has
been "wrapped".

Thanks,
--jeff

----- Original Message -----
From: "Diego del Río" <diegodelrio@hotmail.com>
To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
Sent: Wednesday, November 14, 2001 6:39 AM
Subject: Re: Wrap an HttpServletRequest


> Thank you Thomas and Martin,
> our problem is that the target servlet, i.e. the servlet that would
receive
> the 'wrapped request' forwarded by the first servlet (in this case, the
> target
> servlet is a jsp page), shouldn't know that the request is wrapped.
> We have already implemented a lot of jsp pages (servlets at last) that
> aren't
> aware about attributes in the request they process.
> I know that this functionality is provided by 'filters' in the servlet 2.3
> spec.; unfortunately we are using Tomcat 3.2.3, a servlet 2.2 engine.
>
> > Hi Diego,
> >
> > do it like Martin described. Or try out the RequestDispatcher:
> >
> > request.setAttribute(key1, value1);
> > request.setAttribute(key2, value2);
> > [...]
> > RequestDispatcher rd =
> > getServletContext().getRequestDispatcher(myServletUrl);
> > rd.forward(request, response);
> >
> > Thomas
>
> --
> To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
> For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
> Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>
>


--
To unsubscribe:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands: <mailto:tomcat-user-help@jakarta.apache.org>
Troubles with the list: <mailto:tomcat-user-owner@jakarta.apache.org>


Mime
View raw message