【问题标题】:How to control the href attribute in thymeleaf如何控制百里香中的href属性
【发布时间】:2018-02-21 02:38:04
【问题描述】:

我是百里香的新手。

在 jsp 中问题很简单。但它在百里香中击败了我。

我想完成这个功能如下:

if (page.number<=1)
 html like this:
  <li class="q-pagination-disabled">Pre</li>
else
 <li><a href="/pages/{page.number-1}">Pre</a></li>

但是我不能用 th:if,th:href,th:remove 等等来完成它。 有人知道怎么做吗?

【问题讨论】:

    标签: spring jsp spring-mvc spring-boot thymeleaf


    【解决方案1】:

    尝试以下方法,让我知道它是否适合您

    <li th:if="${page.number le 1}" class="q-pagination-disabled">Pre</li>
    <li th:if="${page.number gt 1}"><a th:href="@{/pages/{page}(page=${page.number-1})}">Pre</a></li>
    

    【讨论】:

      猜你喜欢
      • 2018-09-07
      • 1970-01-01
      • 2017-07-31
      • 2015-03-15
      • 1970-01-01
      • 2021-01-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多