java – 在Thymeleaf模板中显示包含HTML的字符串
如何在Thymeleaf中显示包含HTML标记的字符串?
所以这段代码:
<div th:each="content : ${cmsContent}">
<div class="panel-body" sec:authorize="hasRole('ROLE_ADMIN')">
<div th:switch="${content.reference}">
<div th:case="'home.admin'">
<p th:text="${content.text}"></p>
</div>
</div>
</div>
//More code....
在这行代码片段${content.text}中,它在浏览器上直接生成:
<p>test</p>
但我想在浏览器上显示:
测试