弹簧形式:输入数字 [英] Spring form:input for number
问题描述
我使用Spring的form:input如下:
< form:input type =number... ..>
在我的jsp中,但当我检查在浏览器上呈现的html时,它显示为:
type =numbertype =text
即在html中生成两个 type
属性。另一方面,如果我在浏览器中使用 inspect元素选项进行检查,它会显示正确的 - 只有类型我的问题:为什么我在生成的html中获得两个类型属性(
)?如何解决它? css> =number
type =numbertype =text
Spring form:input
您的代码中使用的任何属性类型
和 type = number
都属于 html5 input tag
还有查看 HTML文本输入只允许输入数字
Spring form tld列出 form:input
元素的有效属性此处
I am using Spring's form:input as below :
<form:input type="number" .....>
in my jsp but when I check the html that is rendered on the browser it shows like :
type="number" type="text"
i.e., two type
attributes are generated in the html.
On the other hand, if I check using inspect element option in the browser, it shows correct - only type="number"
as expected.
Edit- My Question: Why am I getting two type attributes in generated html (type="number" type="text"
) ? How to get it resolved?
Spring form:input
tag doesnt have any attribute named type
and the type=number
used in your code belongs to html5 input tag
Also have a look at HTML Text Input allow only Numeric input
Spring form tld lists the valid attributes of form:input
element here
这篇关于弹簧形式:输入数字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!