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>

 


  





免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM