th:switch 应用
<th:block th:switch=”${mapResult.bidType}”>
<th:block th:case=”‘1′”>
<head th:replace=”common/include-header :: header (${bidProjectTypeMap[mapResult.bidProjectType]}+’ 公告变更 ’)”/>
</th:block>
<th:block th:case=”‘2′”>
<head th:replace=”common/include-header :: header (‘ 投标邀请变更 ’)”/>
</th:block>
<th:block th:case=”*”>
<head th:replace=”common/include-header :: header (${bidProjectTypeMap[mapResult.bidProjectType]}+’ 公告变更 ’)”/>
</th:block>
</th:block>
判断对象属性是否存在
<p class=”project-name” th:if=”${#maps.containsKey(mapResult, ‘bidType’)}”>
<span th:text=”${mapResult.bidType}”></span>
</p>
另
// 判断对象的属性是否存在
var userMobile = [[${user?.mobile}]];
页面定义变更 th:with
<html xmlns:th=”http://www.thymeleaf.org” th:with=”COMPANY_NAME=’ 聯成化學科技股份有限公司 '”>