I am new to Spring MVC and completely new to ThymeLeaf .
So, I am working on a web application using TymeLeaf as a viewing technology, and I have to use this jQuery validation plugin : http://jqueryvalidation.org/
Therefore, I used it in the past in JSP pages.
As shown in the documentation: http://jqueryvalidation.org/documentation/
I need to add the required attribute to an input tag that should be populated by the user, something like this:
<input id="cemail" type="email" name="email" required>
I tried to do this on my TymeLeaf page, as follows:
<input id="nome" name="nome" type="text" th:value="*{nome}" required></input>
But now the problem is that I get this error message in the stacktrace console, and the page does not render renderd:
15:36:47,180 ERROR [org.thymeleaf.templateparser.ErrorHandler] (http-localhost/127.0.0.1:8080-3) [THYMELEAF][http-localhost/127.0.0.1:8080-3] Fatal error during parsing: org.xml.sax.SAXParseException; lineNumber: 88; columnNumber: 78; Attribute name "required" associated with an element type "input" must be followed by the ' = ' character. at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:196) at org.apache.xerces.util.ErrorHandlerWrapper.fatalError(ErrorHandlerWrapper.java:175)
Why? What's wrong? How can I correctly set the required HTML attribute for an input tag declared on a ThymeLeaf page?
java-ee html spring-mvc model-view-controller thymeleaf
AndreaNobili
source share