如何限制在 struts/Java 中双击按钮? [英] How to restrict double click on button in struts /Java?

查看:20
本文介绍了如何限制在 struts/Java 中双击按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个网络表单.单击按钮时,将触发数据库查询.问题是当用户点击按钮两次时,查询将被触发 2 次.我想阻止这种情况.有什么帮助吗?

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?

推荐答案

看看这里

Struts2 有一个内置的机制来停止双表单提交,它在服务器端而不是客户端工作.如果 TokenInterceptor 不在您使用的 defaultStack 上,您可能需要添加它.

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.

这里是一个快速教程

这篇关于如何限制在 struts/Java 中双击按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆