You don't need to do a lot just add this.disabled='disabled' on onclick event handler of button like below:
form.submit() doesn't include submit button name in request
This code will fail if form is submitted by this.form.submit(), rather than clicking submit button. Traditionally name of submit button is included in HTTP request only if form is submitted by clicking submit button otherwise no. Fortunately there is a workaround to this problem, You can call document.form_name.submit_name.click() to simulate click on submit button. This will include name of submit button in HTTP POST request and above Spring MVC example will work as expected. If you don't have multiple buttons on screen and only have one submit button than you can also use HTML hidden input field to send name of submit button as shown in below example:
Since code is only checking for any named parameter with name SUBMIT it will work.
What if you have multiple submit button in one screen
There are cases when you have multiple HTML button in one screen like "Accept" or "Decline", "Yes or "No" , Accept" or "Reject" etc. In this case, clicking one button should disable both buttons because there are intended for one operation. In order to disable multiple submit button in onclick, You need to explicitly disable those buttons. As in following example, if you have two buttons with name accept and decline , we are disabling both when any of the button get clicked.
Other Java web tutorials and Interview questions you may like