Javascript 锚文本url未显示为th:text-Leaf中的链接
我将一些文本转换为显示为链接,它正确地来自后端,但在UI上它不显示为链接。 我正在使用thymelaf渲染p标记内的文本。请查找以下代码: html文件:Javascript 锚文本url未显示为th:text-Leaf中的链接,javascript,jquery,html,spring-boot,thymeleaf,Javascript,Jquery,Html,Spring Boot,Thymeleaf,我将一些文本转换为显示为链接,它正确地来自后端,但在UI上它不显示为链接。 我正在使用thymelaf渲染p标记内的文本。请查找以下代码: html文件: <div class="column" style="margin-left: auto; margin-right: auto; float: none;" th:each="pre:${prrMap}"> <div class="prerequisite" align="center">
<div class="column" style="margin-left: auto; margin-right: auto; float: none;" th:each="pre:${prrMap}">
<div class="prerequisite" align="center">
<label class="prerequisite" th:text="${pre.key}"></label>
<p class="prerequisite" id="prerequisite" th:text=${pre.value}></p>
</div>
</div>
th:text=${pre.value}包含包含锚文本的字符串
示例:${pre.value}=“先决条件:测试数据{a
href=”https://ecom-test-data.index.html“}测试链接{/a}已创建链接
数据,但不显示为链接“
我不能在这里包含锚文本标记,所以使用了{}=,它显示在前端
例外输出:先决条件:测试数据链路
已创建数据但未显示为链接
如果您希望输出未缩放的html,请使用
th:utext
(而不是th:text
)。谢谢,它可以工作,但不适用于新行。在开发工具中它显示正确,但在UI(chrome)中它不显示相同。转换字符串以使其在html中看起来良好有很多问题。如果您想要换行,必须使用
。Html不保留空白。