当前位置:网站首页>thymeleaf应用笔记
thymeleaf应用笔记
2022-07-21 09:30:00 【爬行的黄鹂鸟】
thymeleaf应用笔记
1. 循环整数
使用#numbers.sequence方法,具体应用如下:
<select class="form-control">
<option th:each="num, numStat : ${#numbers.sequence(0,29)}" th:text="${numStat.index+1}" th:value="${numStat.index+1}"></option>
</select>
效果图如下:
2. 循环列表
使用th:each标签,示例如下:
<div class="row" id="list" th:each="obj : ${objects}">
<div class="form-group">
<label class="col-sm-4 control-label" th:text="${@dict.getLabel('XXXX',obj.type,'')}"></label>
<div class="col-sm-8">
<div class="form-control-static " th:text="${obj.val}" ></div>
</div>
</div>
</div>
3. th:onclick使用方式
thymeleaf:2.2.13版本写法如下:
<h2 th:each="tdxx,tdxxStat : ${lists}">
<span th:text="${tdxx.typeName}" th:id="'filetype'+${tdxxStat.index}" th:onclick="viewPic([[${tdxx.id}]],[[${tdxx.type}]]);"></span>
</h2>
4. th:if使用
th:if="${not #strings.isEmpty(name)}"
边栏推荐
- [natural language processing] pre training word vector Baidu cloud download [word2vec, glove, fasttext]
- MySQL insert data error
- 云原生(九) | Devops篇之Jenkins安装与实战
- 3625. Power
- 面试北京XX科技总结
- Qt | Qt的项目文件.pro文件详解
- Minor spanning tree
- 童年的回忆小游戏来了——贪吃蛇,快来自己动手写一个属于自己的小游戏吧
- Vmware Workstation Pro虚拟机网络三种网卡类型及使用方式
- 基于三维GIS的场数据模型研究与实践
猜你喜欢
07.02 哈夫曼编码
OSPF comprehensive experiment
VLAN与三层交换机
H5 website access wechat payment (H5 payment +jsapi payment)
DHCP protocol
Hcip day 8 notes
How does the computer access the Internet (II) from network cable to network equipment
[intensive reading of thesis]attention is all you need
3537. Tree lookup
[Development Tutorial 4] crazy shell · humanoid hip-hop robot PC upper computer online debugging
随机推荐
第二章 软件过程与思想 第一节 基础
Seata details of distributed transactions
Skywalking integrated logging framework, alarm and high availability cluster construction
The quality section of the development period is selected from "smell defects and be happy" (this book can be downloaded for free)
[213] interview questions asked by go language
Gateway integrates sentinel to implement flow restriction rules for routing
Mqtt source code analysis
win10安装nvm
Fluent introduces the graphic verification code and retains the sessionid
Interview Beijing XX technology summary
[intensive reading of thesis]attention is all you need
Minor spanning tree
(leisure) leetcode9 Palindrome Number
MySQL installed in MAC M1, enable binlog
How the computer accesses the Internet (I) message generation DNS
SQL basic statement exercise
指南针 司南
SVD奇异值分解——矩阵压缩
js对象:检测属性是否存在
静态路由原理与配置