【Thymeleaf】 循环固定次数/循环次数由变量控制
生活随笔
收集整理的這篇文章主要介紹了
【Thymeleaf】 循环固定次数/循环次数由变量控制
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
前言
- Thymeleaf 3.0
循環5次
輸出5個li:
<ul><li th:each="index:${#numbers.sequence(1, 5)}" >[(${index})]. some thing</li> </ul>輸出結果:
<ul><li>1. some thing</li><li>2. some thing</li><li>3. some thing</li><li>4. some thing</li><li>5. some thing</li> </ul>循環次數由變量控制
輸出5個li:
<ul th:with="liSize=5"><li th:each="index : ${#numbers.sequence(1, liSize)}" >[(${index})]. some thing</li> </ul>輸出結果:
<ul><li>1. some thing</li><li>2. some thing</li><li>3. some thing</li><li>4. some thing</li><li>5. some thing</li> </ul>總結
以上是生活随笔為你收集整理的【Thymeleaf】 循环固定次数/循环次数由变量控制的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Tenda腾达路由器默认登陆IP地址是多
- 下一篇: maven 引入net.sf.json-