Reputation: 430
I have the following code that I believe I need to escape in thymeleaf.
th:required=""
It throws the following error:
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: ""
Any suggestions?
Upvotes: 1
Views: 1945
Reputation: 77177
The problem isn't that you need an escape, it's that you need an expression that Thymeleaf can interpret as true or false. th:required="${expression}"
tells it to include the required
attribute if expression
is true and leave it out otherwise. If you want to include it unconditionally, drop the Thymeleaf namespace and just include an ordinary required="required"
.
Upvotes: 2