refresh in jsp

B

Bo Rasmussen

Hi,

I've run into what I guess should be common knowledge. The problem goes like
this

I have a rather simple web application with some buttons that fires a POST
request when hit. The parameters for the request could e.g. be
"reserve=yes". The problem is that when the user refreshes the page (done
manually) that same request is fired again resulting in another reservation.
The address line in IE says http://mydomain/mypage.jsp but somehow I receive
a POST request http://mydomain/mypage.jsp?reserve=yes. How do I take care
of this situation - or have I misunderstood something. I was told that if I
used POST requests things should work....

Regards
Bo Rasmussen
 
N

Nathan Zumwalt

If a user hits the reload button (even with a POST request), the
reqeust will be re-submitted. You can warn users not to push the
refresh button. Or, you can redirect to another page, so that even if
the user clicks reload button, the request to the original page isn't
submitted.

//Nathan
 
P

Peter Kirk

Bo Rasmussen said:
I have a rather simple web application with some buttons that fires a POST
request when hit. The parameters for the request could e.g. be
"reserve=yes". The problem is that when the user refreshes the page (done
manually) that same request is fired again resulting in another reservation.
The address line in IE says http://mydomain/mypage.jsp but somehow I receive
a POST request http://mydomain/mypage.jsp?reserve=yes. How do I take care
of this situation - or have I misunderstood something. I was told that if I
used POST requests things should work....

I think there is a technique using a "token" in the session and on the page.

I have never used this technique so the details are a bit hazy for me: it
has something to do with your application generating a unique token (a
string of text/numbers which is "unique" - timestamp maybe?) which it puts
in the session and on the page (as a hidden input field). When the request
comes in they should match for the request to be genuine. If they don't
match it is because your application has generated a new token in the
session, but it was an old token from a resubmitted page... or something...
sorry I can't be more helpful.

Peter
 
B

Bo Rasmussen

Hi Nathan,

Thanks ;o)

Bo
Nathan Zumwalt said:
If a user hits the reload button (even with a POST request), the
reqeust will be re-submitted. You can warn users not to push the
refresh button. Or, you can redirect to another page, so that even if
the user clicks reload button, the request to the original page isn't
submitted.

//Nathan

"Bo Rasmussen" <[email protected]> wrote in message
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top