Title: RE: How can I get parameters with '&' in it ?

Doh!  You're absolutely right.  I scanned through the docs quickly when I answered and grabbed the wrong "encode" method.

And yes, it should be thread safe.

Sorry for the incorrect info...

-----Original Message-----
From: Mike Haberman [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 15, 2000 9:43 AM
To: [EMAIL PROTECTED]
Subject: Re: How can I get parameters with '&' in it ?


Two things:

javax.servlet.http.HttpServletResponse.encodeURL() dosn't do anything
if you're not using sessions.  Is that a correct statement?

The answer seems to be in URLEncoder.encode();  It does the job!
This is a static class method.  Can I assume it's thread safe (i.e. it
only accesses stack variables)?


thanks again!!!




On Fri, May 12, 2000 at 10:14:04PM -0500, Chris Murphy wrote:
> You need to encode the value of the url parameter.
>
> Look at the javax.servlet.http.HttpServletResponse.encodeURL(String url)
> method.
>
> NOTE: you only want to encode the values, not the names, of the parameters.
> And it's
> good practice to always do this.
>
> Good luck.
>
> -----Original Message-----
> From: Mike Haberman [mailto:[EMAIL PROTECTED]]
> Sent: Friday, May 12, 2000 8:11 PM
> To: [EMAIL PROTECTED]
> Subject: How can I get parameters with '&' in it ?
>
>
> Hello all,
>
>    I have a servlet that reads in parameters from a get request.  The
>    problem is that one of the parameters is a url.  If that url
>    has an '&' in it, then the parameters are split around it.
>
>    for example:
>
>    <A HREF = "mysevlet?name=bob&age=23&url=http://blah.com/runme?a=b&c=7">
>
>     in myservlet i get
>     name:bob
>     age:23
>     url:http:..runme?
>     a:b
>     c:7
>
>     What's the fix so I only get three parameters?
>
>     thanks for your time!
>
>     [EMAIL PROTECTED]
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to