JSF中的仅数字文本字段 [英] Digit only text field in JSF
本文介绍了JSF中的仅数字文本字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在JSF中允许文本字段仅允许数字?我在Google上进行了很多搜索,但是在JSF中找不到解决方案.
How to allow a text field to permit only digits in JSF? I searched about it on Google a lot but could not find the solution in JSF.
推荐答案
只需将其绑定到Integer
属性.
Just bind it to an Integer
property.
例如
private Integer number;
使用
<h:inputText id="number" value="#{bean.number}" />
<h:message for="number" />
当您提交非数字数字时,它将显示转换错误.
It'll show a conversion error when you submit non-digits.
这篇关于JSF中的仅数字文本字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文