Try looking at java.net.URLEncoder.

Example: "name"+URLEncoder.encode("Steve Smith");

Remember that the first keyword in a GET request has a prefix of "?".

Example: http://www.somewhere.com/sayhello.jsp?Name=Steve+Smith&Hobby=Fishing

Good luck!








Constantin Nickonov <[EMAIL PROTECTED]> on 01/27/2000 09:45:09 AM

Please respond to "A mailing list for discussion about Sun Microsystem's Java
      Servlet API Technology." <[EMAIL PROTECTED]>








 To:      [EMAIL PROTECTED]

 cc:      (bcc: Thermond Adams/FRB12)



 Subject: encoding String for GET method









Does someone have a Java method handy to encode a String to mimic a GET
form method, i.e., convert something like:

  name=Steve Smith

to

  name=Steve+Smith

I am writing a servlet, which must generate a URL outside a form (which
does this automatically). Spaces and special characters are changed to
comply with URL specs.

Thanks in advance!
Constantin

___________________________________________________________________________
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