GeeCON Prague 2014*
The moose likes Servlets and the fly likes Class to Encode a string for a url Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "Class to Encode a string for a url" Watch "Class to Encode a string for a url" New topic
Author

Class to Encode a string for a url

Adam Dear
Greenhorn

Joined: Oct 21, 2003
Posts: 13
Does anyone know where I might find a class that will convert a normal string into one that is formated for a url? What I mean is if I pass it a string:

This is a string

I want it to return:

This+is+a+string

so that I can append this to a url in an anchor tag which is generated through a servlet, bean, jsp or whatever.

Thanks
-A
Dave Robbins
Ranch Hand

Joined: Sep 16, 2003
Posts: 131
this works for me

http://www.rgagnon.com/javadetails/java-0084.html
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61306
    
  66

java.net.URLEncoder


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
GeeCON Prague 2014
 
subject: Class to Encode a string for a url