我有 2 个文本字段,第一个用于电子邮件,第二个用于确认电子邮件。用户不能在struts 2的confirm s:textfield中粘贴(ctrl+v或用鼠标)任何内容。
我创建的所有示例都只使用简单的html,我可以使用Struts 2的文本字段吗?
最佳答案
The problem of the other examples is that all was based on "onPaste" event in the html edit text, and the textfield of Struts2 doesn't have this event.
对于具有以下功能的 Struts UI 标签来说,这不是问题:
Dynamic Attributes Allowed: true
<s:textfield/>
,以及 <s:file/>
, <s:textarea/>
和其他人,有它,as you can read in the documentation (在参数下)。
这意味着您在标记中编写的所有内容(不是 Struts UI 标记属性)都将按原样在生成的 HTML 中报告,让您可以使用新功能,而无需强制 Apache 发布新版本的标记。
关于javascript - 如何禁用文本字段中的粘贴,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21255632/