Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

URL arguments

 
Joshi Thomas
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to pass a URL as argument to another jsp page, unfortunately the URL (argument) also contains an argument and I cannot get the value of the URL.
eg: test.jsp?url=microsoft.com/default.asp?x=5
I want the value of url to be "microsoft.com/default.asp?x=5" but when I do a request.getparameter("url"), I am getting null for the url.
Thanks in advance.
Joshi
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65114
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to encode the URL that you use as a request parameter argument so that it doesn't confuse the URL parsers.
Check out the java.net.URLEncoder and java.net.URLDecoder classes.
hth,
bear
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic