Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

request.getParameter() problem  RSS feed

 
Venki Ananth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am passing some parameter with url. When i try to get that in servlet its not working.
This is the exact parameter ("http://website/something%2Ftags") that i am passing with url like
"http://host:portnumber/mysite/index.jsp?url=http://website/something%2Ftags" but when i try to get this parameter in servlet its not passing in the same format.

Getting url parameter in Servelt :


but the url in servlet is passing like this "http://website/something/tags". I know jsp is changing "%2F" into "/". The problem is i dont want this change. I need the parameter as ("http://website/something%2Ftags") it is.

How can i do it?

Help guys!!!
 
Deepak Bala
Bartender
Posts: 6663
5
Firefox Browser Linux MyEclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thats URL encoding and they mean the same thing.

URL Encoding

Why do you have such a requirement
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66208
151
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Parameters, at least with a GET, are what follow the ? in the URL. No ?, no getParameter().

There are other methods on the request to find the path parts of the URL. Explore those.
 
Venki Ananth
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Guys!

I used " request.getQueryString()" and it worked.

Thanks for your reply guys.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!