thymeleaf 标签的使用

1.html页面 

2.th:each使用实例

<div class="col-sm-2">
<select id="vehiclesFormalities" class="form-control" title="请选择">
<option value="">请选择</option>
<option th:each="item,itemStat : ${vehiclesFormalitiesEnum}" th:value="${item.code}" th:text="${item.name}"></option>
</select>
</div>

3.
th:text标签使用实例
<tr>
<td class="text-center tdClass" th:text = "${model?.vinNo}">
</td>
<td class="text-center tdClass" th:text="${model.brandName +' | '+model.carSeriesName +' | '+ model.vehicleModelName +' | ' + model.color}">
</td>
</tr>
4.input标签也用value 不用text
5.简单数据转换(数字,日期)product.price 不能写成product?.price
感谢 https://blog.csdn.net/qwlzxx/article/details/70976509

   <dd th:text="${#numbers.formatDecimal(product.price, 1, 2)}">180</dd>
   <dd th:text="${#dates.format(product.availableFrom, 'yyyy-MM-dd')}">2014-12-01</dd>


  




原文地址:https://www.cnblogs.com/beixiaoyi/p/9831327.html