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

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

Reply via email to