Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

request.getQueryString() returning null?

 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know why request.getQueryString() would return a null, even when I am posting? Here's the deal....I'm trying to prevent my users from posting again using the refresh button on the right click of the mouse button. By getting the query string off of the request, I can determine if the request was already submitted, however I can't seem to get anything but a null using the "request.getQueryString()"?
P.S. I'm using J2EE. Version 3.5.3.
Thanks!
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Since there's no query string on a post (the parameter data is sent as part of the body), it's not surprising you are not getting anything.
But backing up a bit, I'm not sure that your technique for detecting multiple posts via refresh is sound. This very topic has been discussed a number of times in the past, and a quick search though this (and perhaps the Servlets forum) will point you in the right direction.
bear
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So when my user updates an input field and hits the update button, it works fine. However, if they hit the update button, the input fields are disabled on post if the values have not been updated. But let's say they walk away from their computer for just a "second" and come back to hit the refresh button. The data gets submitted again even though no changes have been made.
Just out of curiosity, how do you get the parameters from the body of the form or is there a way?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64688
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't have to worry about how the parameters are passed to the request, the request.getParameter() method hides any differences between get and post operations.
With regards to detecting when a post is re-submitted as a result of a refresh, did you look for previous topics on this subject? There's good information for you there.
bear
 
Shannon Sims
Ranch Hand
Posts: 197
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, thanks. I will search for topics regarding "when a post is re-submitted as a result of a refresh".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic