Spring boot Thymeleaf th:文本忽略HTML标记
您好,我在模板中有如下文本:Spring boot Thymeleaf th:文本忽略HTML标记,spring-boot,thymeleaf,Spring Boot,Thymeleaf,您好,我在模板中有如下文本: <p th:text="${title.nameproduct}" > <small>Small subtitle</small> </p> <p>Apple</p> <p>Apple <sm
<p th:text="${title.nameproduct}" >
<small>Small subtitle</small>
</p>
<p>Apple</p>
<p>Apple
<small>Subtitle - apple</small>
</p>
小字幕
它给了我这样一个结果:
<p th:text="${title.nameproduct}" >
<small>Small subtitle</small>
</p>
<p>Apple</p>
<p>Apple
<small>Subtitle - apple</small>
</p>
苹果公司
我想要这样的输出:
<p th:text="${title.nameproduct}" >
<small>Small subtitle</small>
</p>
<p>Apple</p>
<p>Apple
<small>Subtitle - apple</small>
</p>
苹果公司
字幕-苹果
有人能帮我吗?您可以创建另一个标记,例如
,并分别设置此
和您的
的文本
<p>
<span th:text="${title.nameproduct}">Apple</span>
<small th:text="${subtitle.nameproduct}">Subtitle - apple</small>
</p>
在title.html.formatted.content
变量中,您可以预先格式化html