This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Restricting the query string parameters from populating the form value 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 » Servlets
Bookmark "Restricting the query string parameters from populating the form value" Watch "Restricting the query string parameters from populating the form value" New topic
Author

Restricting the query string parameters from populating the form value

Mukunda s Dhakate
Greenhorn

Joined: Oct 29, 2007
Posts: 12
My action uses POST method,
on submitting the form it takes the form values as input values from screen.
But if I append the form variables and their values in the query string and hit the edited URL,
the action gets submitted with the proper values that entered in the query string.

I want to restrict it from populating the form values from query string.

How can it be done?
Please help
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

Don't process a GET request with form values?
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61063
    
  66

"Sleeping God", please check your private messages for an important administrative matter.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61063
    
  66

Cannot be easily done. You'll have to inspect the query string to see which parameters came from it, and manually ignore them.

You should never purposefully place a query string on a POST request.
Mark E Hansen
Ranch Hand

Joined: Apr 01, 2009
Posts: 643
Even if you could do this, you can't prevent a user from making up their own values for the post anyway.
What do you think will be the benefit of what you are trying to do?
 
jQuery in Action, 2nd edition
 
subject: Restricting the query string parameters from populating the form value