java 如何在 Spring-MVC 中添加“必需”属性
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16305907/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 22:35:47 来源:igfitidea点击:
How can I add "required" attribute in Spring-MVC
提问by SJS
How can I add "required" attribute in Spring-MVC?
如何在 Spring-MVC 中添加“必需”属性?
I want the ending tag to look like this
我希望结束标签看起来像这样
<input type="text" name="usrname" required>
So I am doing the following in my JSP
所以我在我的 JSP 中执行以下操作
<form:input path="usrname" maxlength="12" required/>
But I am gettng a error
但我得到了一个错误
回答by SJS
I found the fix. my code had to me like this
我找到了解决办法。我的代码对我来说是这样的
<form:input path="usrname" maxlength="12" required="required"/>
Now it works.. :)
现在它可以工作了.. :)