Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to restrict double click on button in struts /Java?

Tags:

java

struts2

I have created a web form. On Click of button, database query would be fired. The Problem is that when user clicks on button twice, query would be fired 2 times. I want to prevent that. Any help?

like image 374
Jwalin Shah Avatar asked Feb 06 '26 07:02

Jwalin Shah


1 Answers

Take a look here

Struts2 has a built in mechanism for stopping double form submission that works on the server side instead of the client. You may need to add the TokenInterceptor if its not on the defaultStack you're using.

Here is a quick tutorial

like image 181
Liviu T. Avatar answered Feb 07 '26 19:02

Liviu T.



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!