关于struts

来源:百度知道 编辑:UC知道 时间:2024/05/06 13:57:12
在普通jsp中写入如下html代码:

<input type="text" name="name" style="ime-mode:disabled"
onkeyup="value=value.replace(/[\W]/g,'')"
onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^\d]/g,''))"
onkeydown="if(event.keyCode==13)event.keyCode=9">
可正常运行,达到屏蔽输入法,过滤(不显示,不接受)除字母,下划线,数字以外非法字符的效果

可在Struts:<html:text property="username"/>中,
property="username"后面直接插入 style="ime-m...........event.keyCode=9"
无法通过编译,

求哪位J2EE高手帮帮忙,
看看我该怎么嵌,或 Struts中有什么写法可达到同样效果

谢谢了!

style,onkeyup,onkeydown 属性是可以用的,
但是onbeforepaste属性不支持,可以自定义标签类继承org.apache.struts.taglib.html.TextTag,添加onbeforepaste属性就可以用了

想这个的操作 个人认为还是使用静态标签好了