0、
默认页面是.html 且需要位于 根目录/templates/目录下 这个根就是 src/main/resources
典型的页面表头引用为
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
1、
<div th:switch="${caseInfo.govState}">
<p th:case="true">
<td class="lefttxt">是</td>
</p>
<p th:case="false">
<td class="lefttxt">不</td>
</p>
</div>
2、
<div th:switch="${caseInfo.insertTime==null}">
<p th:case="true"><td></td></p>
<p th:case="false"><td th:text="${#dates.format(caseInfo.insertTime,'yyyy-MM-dd HH:mm')}">未通过</td></p>
</div>
switch default
<p th:case="*">相当于 default</p>
3、
<tr th:each="caseInfo:${page.list}">
<td th:text="${caseInfo.id}"></td>
</tr>
读取序数,名字都是自定义的
<tr th:each="vo,voStat:${caseInfo.list}">
<td th:text="${voStat.index}+1"></td>
4、
<td th:text="${#dates.format(caseInfo.insertTime,'yyyy-MM-dd HH:mm')}"></td>
5、
<a class="acicon" th:if="${caseInfo.status eq 0}"><img th:src="@{/img/common/listtt.png}" th:name="${caseInfo.applyRecordId}" onclick="report(this);"/></a>
6、
<iframe th:src="${caseInfo.seedRecordUrl}"></iframe>
7、
<img th:src="@{/}+${demo.qrCodeUrl}" alt="图片"></img>
8、
<form th:action="@{/aaa/bbb}" th:object="${userBean}" method="post" id="demo_from">
<select id="status" name="status" class="selectpicker">
<option value="1" th:selected="${status=='1'}">未通过</option>
<option value="2" th:selected="${status=='2'}">通过</option>
</select>
<input type="hidden" th:name="id" th:value="${demoBean.id}"/>
</form>
9、
<lable>是<input type="radio" name="state" value="true" th:checked="${demoBean.state==true}"></input></lable>
<lable>否<input type="radio" name="state" value="false" th:checked="${demoBean.state==false}"></input></lable>
10、
<td class="lefttxt" width="35%" th:text="'申请 '+(${demoBean.number}==null?0:${demoBean.number})+' 个'"></td>
11、
<input type="text" name="number" th:value="${demoBean.number}"></input>
12、
<select class="selectpicker" name="roleId">
<option th:each="roleInfo : ${roleInfos}" th:value="${roleInfo.roleId}"
th:selected="(*{roleId} == ${roleInfo.roleId})" th:text="${roleInfo.roleName}"></option>
</select>
13、
<a class="btn btn-success" th:href="@{/apath/bpath?source=1}">点击</a>
14、
userStat是状态变量,有 index,count,size,current,even,odd,first,last等属性,如果没有显示设置状态变量,thymeleaf会默 认给个“变量名+Stat"的状态变量。
<tr th:each="map,userStat : ${userInfo.qualificationPhotoList}">
<div class="active item" th:if="${userStat.index eq 0}"><img th:src="${map.photo}" /></div>
<div class="item" th:if="${userStat.index ne 0}"><img th:src="${map.photo}" /></div>
</tr>
15、
onclick="window.history.go(-1)"
16、数组遍历
<td th:each="url:${arrayContracts}" width="120" height="80" ><img th:src="${url}" alt="图片无法显示" style="border-style: solid"/></td>