wood burning stoves*
The moose likes JSP and the fly likes URL arguments Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "URL arguments" Watch "URL arguments" New topic

URL arguments

Joshi Thomas

Joined: Oct 03, 2002
Posts: 7
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.

Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 61071

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.

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
I agree. Here's the link: http://aspose.com/file-tools
subject: URL arguments