[英]How to escape double quotes in in thymeleaf?
我有以下代码,我相信我需要在百里香中转义。
th:required=""
它引发以下错误:
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression: ""
有什么建议么?
问题不在于您需要转义,而是您需要Thymeleaf可以将其解释为true或false的表达式。 th:required="${expression}"
告诉它如果expression
为true,则包括required
属性,否则不包含。 如果要无条件包含它,则删除Thymeleaf命名空间,仅包含一个普通的required="required"
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.