[英]Formatting a tag is not working with Thymeleaf
为什么这段代码在文本之前显示图像:
<p>
<span>
<img src="../assets/images/favorite.svg" height="12px"/>
</span>
Baked Alaskan Salmon with Asparagus
</p>
但是当用Thymeleaf格式化时,它不会显示图像:
<p th:text="@{' ' + ${recipe.name}}">
<span>
<img src="../assets/images/favorite.svg" height="12px"/>
</span>
Baked Alaskan Salmon with Asparagus
</p>
尝试使用Thymleaf's
th:inline="text"
标签在Thymleaf
处理过的标签内显示html内容。 下面的代码应该工作,虽然我没有测试过
<p th:inline="text">
[[@{' ' + ${recipe.name}}]]
<span>
<img src="../assets/images/favorite.svg" style="height:12px"/>
</span>
Baked Alaskan Salmon with Asparagus
</p>
有关inline
代码如何工作的更多说明,请查看文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.