One. Objective
You in any more professional BBS will see this problem, even if you Google, you will find a lot of people in the attention and inquiry, but all the solutions are different, (some people advocate the use of script to solve, some want to redirect to other pages; Some will raise this issue to the point of token) Why is there such a big difference? Anshan to see the best hospital of vitiligo is which home www.0412r.com
Two. Problem Scenario
First of all, we should understand why we have to deal with such a problem? or a professional is what is the right scene? (It seems that only people come to ask no one to explain)
1. Repeatedly committed, repeated refreshes of the scene
Repeated commits, repeated refreshes are all to resolve the system duplication of records. In other words, someone commits a record multiple times (why?) may be idle and nothing to do; most likely, users simply don't know if their submission has been executed?!).
But there are problems that do not necessarily have to be dealt with, depends on the type of system you are developing. For example, you take over a resource management system, the system itself from the point of view of demand does not allow the "duplicate" record, in such constraints, to perform repetitive commit action will only lead to "business-level exception" generation, it is impossible to implement the success of the problem is not to avoid avoiding. Anshan Treatment Vitiligo Hospital expert www.0412r.com
2. Scenes to prevent retreat
Learn about recurring refreshes, repeating submissions, and what is the reason for the "Back up" operation? For example, you are developing a voting system that has many steps and links between the steps, such as the first step, which sends some information to the second step, and the second step caches the information. At the same time send their own information to the third step ..... And so on, if at this time the user is in the third step, we imagine a naughty user's user clicked the Back button, the screen appears the second step of the page, he again modified or submitted again, into the next step (that is, the third step), the error will be generated here?! What's wrong? The most typical is that this operation directly leads to the loss of information for the first step! (If this information is stored on the request, of course you can store it in the session or in a larger context, but that's not a good idea!). For information on the storage of the problem, next time on this issue in detail discussion)
Three. How to deal with the problem
Of course a lot of systems (such as the booking system from the demand itself is to allow individuals to repeat the booking) is necessary to avoid repeated refreshes, repeated submissions, and prevent back problems, but even the problem, but also to distinguish how to deal with and where to deal with (online just tell you how to deal with, but rarely to distinguish where to deal with) , obviously the way to deal with is nothing more than the client or server-side two, and the face of different location processing is different, but one thing to declare beforehand: any client (especially the B/s side) processing is not trustworthy, the best and most should be the server-side processing methods.
Client processing:
Facing the client we can use JavaScript script to solve, as follows
1. Repeat refresh, repeat commit
Ways One: Sets a variable that is allowed to be submitted only once.
JSP tutorial for resolving JSP repeated submissions