| 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).

How would I do this?  This is basically what Jakarta Commons HTTPClient
package (org.apache.commons.httpclient.*) offers, correct?

I thought such manipulation would be achievable without additional packages.


| Why do you believe that adding parameters to the URL is not scalable?
Well, its not scalegent, to coin a term;
String munging is expensive (scalability), and
StringBuffer sb = new StringBuffer();
sb.append("page.jsp?").append("foo=").append(bar).append("&color=").append(myColor).etc()
is rough to look at (elegent).

Why not just:
HashMap myParams = new HashMap();
myParams.put("foo", bar);
...
pageContext.forward("page.jsp", myParams)   ?

much more efficient and elegent, imho.

I understand that it all eventually boils down to a bunch of String munging,
but the above hypothetical method could take of it that for us and would
really make my life easier ;-)

thanks



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

> -----BEGIN PGP SIGNED MESSAGE-----
> 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
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (MingW32)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
>
> iEYEARECAAYFAkiZ3KwACgkQ9CaO5/Lv0PA+cQCgs/6qvuqQEcK24o6fId1K3kgs
> OkMAn3HqZ2E12xFeevo8eKii7yYiKj2p
> =Cixo
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>

Reply via email to