人生到头来,就是不断放下,但永远最|

durtime

园龄:4年8个月粉丝:10关注:1

thymeleaf使用之多变量

1
2
3
4
5
6
7
8
9
10
11
12
13
14
<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}'

还有链接的变量拼接

1
2
3
<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>

 

本文作者:durtime

本文链接:https://www.cnblogs.com/durtime/p/15616615.html

版权声明:本作品采用知识共享署名-非商业性使用-禁止演绎 2.5 中国大陆许可协议进行许可。

posted @   durtime  阅读(209)  评论(0编辑  收藏  举报
历史上的今天:
2020-11-28 每日日报
点击右上角即可分享
微信分享提示
评论
收藏
关注
推荐
深色
回顶
展开