Goal
Basically, I want to distinguish between a normal page submission and a Refresh event fired on Browser window. So that I can stop re-submission.
Brief
I have Spring MVC App
that has Rest URLs
tagged to each Controller, say, one Spring Controller for each CRUD operation. Now, on submitting a request to Add/Edit request a POST
request is sent to the backend controller for the respective Id.
For example
localhost.xxx/add --> add request is sent for a new id auto-generated from backend.
localhost.xxx/edit --> edit request is sent for the id\ record currently edited.
Issue
In my case On pressing F5
after submission again the old request is sent to the backed for the same id.
Achieve
I's like to stop this re-submission of form when F5 key is pressed somehow. Any workaround frontend or backend (redirect event) will do, however, I would be glad to know/prefer what is the ideal way to stop such re-submissions.