thymeleaf - 第 :block and th:remove ="tag" adding undesired spaces

标签 thymeleaf

我想生成纯文本(没有周围的标签),但由于某种原因,我得到了不想要的“白色”字符。如果我尝试

<th:span th:text="myText" th:remove="tag">Placeholder text</th:span>

或者
<th:block th:text="myText">Placeholder text</th:block>

我得到:
"
                                            myText

                                    "

我不确定这是否会影响我进行递归调用后的一行:
<div th:with="nodelist = ${node.children}" th:include="this::fragmentid" th:remove="tag"></div>

可能会发生什么?

提前致谢。

最佳答案

我认为你需要使用 thymeleaf-extras为了那个原因。

关于thymeleaf - 第 :block and th:remove ="tag" adding undesired spaces,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33926616/

相关文章:

java - 为 JSP 和 Thymeleaf 设置两个模板解析器

java - 如何使用 Thymeleaf 制作一个简单的 Java 应用程序(不使用 Spring)

spring - thymeleaf :each two iterate two listings

java - 如何从 thymeleaf 中的属性文件中读取值

spring - 每次都要重启spring mvc吗?

thymeleaf - 如何在 Thymeleaf 中转义 html 变量?

spring-boot - 如何使用 Thymeleaf 将参数从 HTML 传递到 Spring Controller?

使用 thymeleaf 的 Java spring-boot 登录示例代码

java - JavaScript 和 Thymeleaf 中的 Spring 消息

thymeleaf - Thymeleaf 包含和替换之间的区别?