If I send an encoded URL to a servlet, do I have to decode it before using the getParameter() method or is it automatically decoded by the service() method of the servlet?

Alex Chaffee

It's decoded for you. The string you get from getParameter is the actual value the user entered, after having been encoded by the browser and decoded by the servlet engine.

This can cause some confusion when going back and forth from servlet to HTML to servlet again, since it means that the number of encodes does not match the number of decodes you have to write.

See also What is the difference between URL encoding, URL rewriting, and HTML escaping?