[英]anchor text url is not showing as link in th:text thymleaf
我转换了一些文本以显示为链接,它正确地来自后端,但在 UI 上它没有显示为链接。 我正在使用百里香来渲染 p 标签内的文本。 请在下面找到代码:
html文件:
<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"}test link{/a} 链接已创建数据但未显示为链接"
我不能在这里包含锚文本标签,所以使用了 {} = <>,它在前端显示。
例外输出:先决条件:测试数据测试链接链接已创建数据但未显示为链接
如果您希望输出未转义的 html,请使用th:utext
(而不是th:text
)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.