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.