| Author |
Remove one parameter from the query string
|
Nalini Nagarathinam
Greenhorn
Joined: Jun 13, 2010
Posts: 16
|
|
Hi,
I have a requirement, for that i need to remove the particular parameter from the query String.
Let say,
I want to remove the foo parameter from the above query string. Foo parameter can be at anywhere in the string(start, end of the string)
Shall i use regex to find the pattern or any other way to remove it in servlet?
|
Nalini Nagarathinam
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
For what purpose? The query string has already been submitted, what use is there in modifying it?
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Nalini Nagarathinam
Greenhorn
Joined: Jun 13, 2010
Posts: 16
|
|
Hi,
Thank you for your reply
I want to remove one parameter and add a new parameter and post it as the POST request.
This is my requirement.
|
 |
Raza Mohd
Ranch Hand
Joined: Jan 20, 2010
Posts: 247
|
|
use replace method of string .
for example.
|
Good luck!!
A small leak can sink a Gigantic ship.>
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56204
|
|
|
Moved to Java beginner.
|
 |
Nalini Nagarathinam
Greenhorn
Joined: Jun 13, 2010
Posts: 16
|
|
Hi
Wht you have suggestted is fine for to replace the string foo.
But i need to replace the parameter foo=value.
My Solution:
1) we can write the pattern to find the string and replace
2) Use request.getParameterValues& getParameterNames to the parameters, loop through the parameters and remove it.
Thanks,
|
 |
Raza Mohd
Ranch Hand
Joined: Jan 20, 2010
Posts: 247
|
|
ok great..
second one looks more appropriate.
|
 |
 |
|
|
subject: Remove one parameter from the query string
|
|
|