I have 2 questions to ask : 1. Is there any method in the Servlet API (or anywhere) that can be used to decode a URL? That is, to replace the %XX symbol with ASCII characters. 2. Can we use HttpServletResponse.encodeURL() and HttpServletResponse.encodeRedirectURL() interchangeably? For example, Can I have a HTML tag printed like this out.println("<a href=" + encodeRedirectURL(myURL) + ">click here</a>"); Please help. Thanks.
I have an answer to your first question but not your second. There is a class called URLDecoder in the Java2 SE. It has a static method called decode that takes a String (the url) and returns the decoded string. You can check out the Java 2 API here.
------------------ Matthew Phillips Sun Certified Programmer for Java 2 Platform
If your query string actually contains name=value pairs, you may rather use the getParameter methods on the request object. For instance, request.getParameterMap() returns the map of requested parameters. ------------------ Beno�t d'Oncieu Sun Certified Programmer for the Java� 2 Platform