13

How can I add "required" attribute in 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

<form:input path="usrname" maxlength="12" required/>

But I am gettng a error

SJS
  • 5,459
  • 19
  • 74
  • 104

1 Answers1

31

I found the fix. my code had to me like this

<form:input path="usrname" maxlength="12" required="required"/>

Now it works.. :)

SJS
  • 5,459
  • 19
  • 74
  • 104