aspose file tools*
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


Win a copy of Spring in Action this week in the Spring forum!
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: 61426
    
  67

java.net.URLEncoder


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
Consider Paul's rocket mass heater.
 
subject: Class to Encode a string for a url