1、传参

th:href="@{/console/createBilling(appKey=${appInfoForm.appKey})}"
2、if判断,并连接用and

th:if="${appInfoForm.billingId ne 0 and appInfoForm.billingPayed eq false}"
3、日期的格式化
th:text="${#dates.format(billingForm.startTime,'yyyy-MM-dd HH:mm:ss')}"
4、单击事件

th:οnclick="'javascript:deleteBilling(\''+${appInfoForm.billingId}+'\',\''+${appInfoForm.appKey}+'\');'"
其中deleteBilling是在js中定义好的方法。
5、html页面中的js必须用/*<![CDATA[*/ this is JavaScript code /*]]>*/包裹,否则会出现些许问题,比如js中&符号的出现会导致页面运行出错。

<script type="text/javascript">
/*<![CDATA[*/
function themPage(value,type){
   alert(value);
}
function themPage2(value,type){
   alert(type);
}
/*]]>*/
</script>
6、循环select 的option项

<select class="form-control" id="slaId" th:field="*{slaId}">
    <option value="0">请选择</option>
    <option th:each="slaItem : ${slaItems}" th:value="${slaItem.id}" th:text="${slaItem.name}">Options</option>
</select>

7、按原样输出带有html标签的字符

使用th:utext就可以,假设msg是java后端传过来的内容是"<br/>"的session变量,那么下面的语句中将会在span标签里面进行一次换行:

<span th:utext="${session.msg}"></span>

8、赋值判断

<li>支持自定义知识库:<strong th:text="${slaItem.supportCustomize eq 1}?'是':'否'"></strong></li>

9、判断集合长度是否是0

th:if="${#lists.size(appInfoFormList)} eq 0"