【问题标题】:Thymeleaf dialect inside a Thymeleaf dialectThymeleaf 方言中的 Thymeleaf 方言
【发布时间】:2017-02-18 05:49:54
【问题描述】:

我想在 Thymeleaf 方言中使用 Thymeleaf 方言,但不能。我已经尝试过,但效果不佳:

<h2 th:text="|${response.name} has: |">
Dunie has: 
    <span th:text="|-${response.size}-|" class="paleo">-4-</span>
</h2>

th:text of h2 删除其中的所有内容。我想在渲染后得到类似的东西:

<h2>
Philie has: 
    <span class="paleo">-3-</span>
</h2>

那么,我怎样才能达到我的目标呢?

【问题讨论】:

    标签: spring-boot thymeleaf


    【解决方案1】:

    使用 th:block http://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#synthetic-thblock-tag

    <h2>
        <th:block th:text="|${response.name} has: |" />
        <span th:text="|-${response.size}-|" class="paleo"></span>
    </h2>
    

    【讨论】:

      猜你喜欢
      • 2018-11-23
      • 2016-03-18
      • 2015-12-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-06-21
      • 1970-01-01
      相关资源
      最近更新 更多