繁体   English   中英

解析百里香文本模板中的特殊字符

[英]Parsing special character in thymeleaf text template

我正在使用 Thymelead Text Temaplate,并想解析特殊字符,如单引号、'&' 等。我正在尝试[# th:text="${'What''s up?'}" /]但它是抛出以下错误:

ERROR a.c.s.d.o.h.c.SubmissionController - Exception evaluating OGNL expression: "'What''s up?'" (template: "sample-template" - line 63, col 4)
org.thymeleaf.exceptions.TemplateProcessingException: Exception evaluating OGNL expression: "'What''s up?'" (template: "sample-template" - line 63, col 4)

你的代码没问题。 例如,这对我有用:

<p th:inline="text">
    [# th:text="${'What''s up?'}" /]
</p>

Thymeleaf 评估您的代码是文本的方式可能有问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM