How do I eliminate the spaces in the query string in a servlet /jsp combo like I would replace them with %20 ?

Troy Niven

Use the java.net.URLEncoder.encode() method as follows:

String temp1 = request.getParameter("something");

The temp1 string will have it's spaces replaced with %20.

Please note that all other special characters will be URLEncoded as well.

0 Comments  (click to add your comment)
Comment and Contribute






(Maximum characters: 1200). You have 1200 characters left.



About | Sitemap | Contact