tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Warren Killian" <>
Subject Re: How to programmatically add parameters to ServletRequest objects?
Date Wed, 06 Aug 2008 18:46:53 GMT
Hi Jonathan,

About ServletRequest and ServletResponse Interfaces not having a
"setParameter(name, value)" method...depending on your situation, you may
not need to do that.  Are you forwarding to another URI within your web
app?  If so, you could use request/session.setAttribute( String name, Object
obj ).  My understanding is that HttpParameters come from HTML forms and
can't really be added to using the Servlet API.  But if the web component
you are forwarding to is within your same application, you can store those
values you wish to add to the URL to the HttpServletRequest/HttpSession as
"scoped attributes".  Hope this helps.

On Wed, Aug 6, 2008 at 1:17 PM, Christopher Schultz <> wrote:

> Hash: SHA1
> Jonathan,
> Jonathan Mast wrote:
> | I can't figure out how to use the pageContext.forward() method like it's
> | equivalent script element:
> Do you mean that you want to add parameters to a forwarded URL without
> using JSP?
> | How do I pass the name-value pair "foo":"bar" using
> pageContext.forward()? I
> | thought there would be a method like forward(String path, Map params) but
> | there isn't.
> Right: you just forward to another URL.
> | Nor is there a setParameter(name, value) method available on
> ServletRequest
> | or ServletResponse (both of which are passed onto the page pointed to in
> | pageContext.forward().
> Right. The request is supposed to be read-only (ignore attributes ;).
> | I don't want to put the parameters in the url itself (ie
> "page.jsp?foo=bar")
> | this approach is not scalable.
> This is really the only way to do it. The other option is to create a
> new request object and stuff your own parameters into it (or, better
> yet, wrap the original request and add your parameters only to the
> wrapper).
> Why do you believe that adding parameters to the URL is not scalable?
> - -chris
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla -
> iEYEARECAAYFAkiZ3KwACgkQ9CaO5/Lv0PA+cQCgs/6qvuqQEcK24o6fId1K3kgs
> OkMAn3HqZ2E12xFeevo8eKii7yYiKj2p
> =Cixo
> ---------------------------------------------------------------------
> To start a new topic, e-mail:
> To unsubscribe, e-mail:
> For additional commands, e-mail:

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message