multiple request submitt on clicking refresh button in browser

Discussions

Web tier: servlets, JSP, Web frameworks: multiple request submitt on clicking refresh button in browser

  1. how can i filter the multiple request being generated if the browser refresh button is being clicked for eg in a servlet it is adding a record in database once it is submitted if user clicks the refresh button duplicate record is added how can i filter the duplicate request by the same user thanks in advance Vishal
  2. Well! There are two simple approaches: 1: Don't let the user submit twice.How? In the form submission, you can replace your submit to button so that it is not submmitted automatically and adding logic to submit.You can javascript to do that. As input type you will use button and onClick you will call a JS function which will check if the same button has been clicked twice. 2:On the server side, you can use servlet session to achieve this. You can check if the client has sent a session id, if not then its a first call, you create the session and associate the new session id by encoding url and re-direct the resquest, if then client has sent a session id, act accordingly. cheers, http://javaicillusion.blogspot.com/
  3. thanks arijit but i am still not able to figure it out how it will work at server side .. as the session id will remain same for then entire session of the user he might navigate to application anywhere till his session id is there thanks in advance vishal