thymeleaf使用总结

一、引入外部文件

在某个标签中使用th:fragment属性定义一个变量名:

thymeleaf使用总结

th:include 引入到标签内部,并替换该标签的内部所有内容;

th:substituteby  引入的部分替换该标签以及该标签的所有内容;

thymeleaf使用总结

thymeleaf使用总结

二、script中不能识别>,<,&&等特殊字符时

// <![CDATA[  

  ...Your script, here 

 // ]]>

thymeleaf使用总结

三、获取工程路径

thymeleaf使用总结

四、基本语法

1. 遍历

thymeleaf使用总结

2. 处理enum

thymeleaf使用总结

3. list长度

thymeleaf使用总结

五、日期格式化

        <dd th:text="${#dates.format(product.availableFrom, 'yyyy-MM-dd HH:mm:ss')}"></dd>

 

转载于:https://my.oschina.net/dslcode/blog/1590530