How do I eliminate the spaces in the query string in a servlet /jsp combo like I would replace them with %20 ?
Created May 4, 2012
Troy Niven Use the
java.net.URLEncoder.encode()
method as follows:
String temp1 = request.getParameter("something"); temp1=java.net.URLEncoder.encode(temp1);
The temp1 string will have it's spaces replaced with %20.
Please note that all other special characters will be URLEncoded as well.