Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to prevent a sUbmit on refresh?

Status
Not open for further replies.

thelordoftherings

Programmer
May 16, 2004
616
IL
Hello,

I have a JSP page with Form in it and a Submit button.
How do I prevent the page from being resubmitted when the client clicks on "Refresh"?
 
You can use javascript to disable the button once the form has been submitted.

 
The solution at this arctcale isvery hazy. Can someone suggest a simple solution to this problem?
 
Sorry correct on the javascript, spaced out on that one.

Redirect after get only works if the user waits to hit refresh after the next page loads.

This is not always the case, what happens quite often is that it is a long lived process and the user invokes it 3-4-5-6 times (like credit card charging).

Best way to do it is to drop a text file somewhere 'charging' or set a session variable 'charging'. Then push that long lived process off into a thread. The user hits refresh, the code checks to see if its already doing this action. If so it goes into a wait state and polls the file etc etc etc.

Thats a very surface analysis of one strategy.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top