在邮件中我想显示一个 java 变量:
context.setVariable("content", "Hi<br>This is a test<p></p>");
在我做的邮件模板中:
<p><span th:text="|${content}|"></span></p>
在邮件中转换为:
<p><span>Hi<br>this is a test<p></p></span></p>
如何使变量得到很好的解释。
谢谢。
最佳答案
使用 th:utext
代替 th:text
http://www.thymeleaf.org/doc/tutorials/2.1/usingthymeleaf.html#unescaped-text
关于 thymeleaf : display a variable containing html tags,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40474680/