• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

request.getQueryString() returning null?

 
Ranch Hand
Posts: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 201
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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".
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic