zoukankan      html  css  js  c++  java
  • thymeleaf使用之多变量

    <div>迭代状态对象</div>
    <table>
        <tr th:each="data,iterState : ${#numbers.sequence(0,2)}"
            th:style="|background-color:| + ${iterState.odd ? 'while' : 'gray'}">
            <td th:text="|从0开头的索引:| + ${iterState.index}"></td>
            <td th:text="|从1开头的索引:| + ${iterState.count}"></td>
            <td th:text="|数据集合大小:| + ${iterState.size}"></td>
            <td th:text="|当前节点:| + ${iterState.current}"></td>
            <td th:text="|是否第一次迭代:| + ${iterState.first}"></td>
            <td th:text="|是否最后一次迭代:| + ${iterState.last}"></td>
            <td th:text="|是否偶数迭代:| + ${iterState.even}"></td>
            <td th:text="|是否奇数迭代:| + ${iterState.odd}"></td>
        </tr>
    </table>
    

     要将文本和变量进行组合,使用如:

    托尔斯泰+'${user}'

    还有链接的变量拼接

              <dl class="layui-nav-child" th:each="reci,reciStat : ${recis}">
                  <dd><a th:href="@{'/ar/'+${reciStat.index}}"  th:text="${reci.keyword}+'('+${reci.number}+')'" target="frame"></a></dd>
              </dl>
    
  • 相关阅读:
    图论概况
    [NOI2006]最大获利
    Dining
    [USACO5.3]校园网Network of Schools 缩点
    I Hate It
    [USACO06JAN]牛的舞会The Cow Prom Tarjan
    爱在心中
    [HAOI2006]受欢迎的牛
    泥泞的道路
    上白泽慧音
  • 原文地址:https://www.cnblogs.com/zhukaile/p/15616615.html
Copyright © 2011-2022 走看看