This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Please help

 
Meng Tan
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic