Springboot的thymeleaf常用屬性

2021-09-17 18:23:46 字數 705 閱讀 1899

th:text對特殊字元進行轉義,作為純文字標籤,等價於內聯方式[[$]]

welcome to thymeleaf!

[[$]]welcome to thymeleaf!

th:utext   對特殊字元不進行轉義,可以顯示出字元的作用,等價於內聯方式[($)]

welcome to thymeleaf!

[($)]welcome to thymeleaf!

div

=18}">成年

成年管理員

老師學生

其他

這是頁面的頭部,導航

th:include 保留自己的標籤,不要th:frament的標籤(thymeleaf 3.0中不推薦使用)

th:insert 保留自己的標籤,保留th:frament的標籤

th:replace 不要自己的標籤,保留th:frament的標籤

spring boot的Scheduler定時任務

configuration enablescheduling 開啟後台任務 public class scheduler cron second,minute,hour,day of month,month,day s of week scheduled cron 0 每分鐘執行一次 schedul...

spring boot的Thymeleaf模板注入

參考 場景是view的名字是使用者可控時,實際測試發現跟spring boot的版本有關,其預設自帶的thymeleaf版本有關。spring boot 1.5.1.release spring boot starter thymeleaf 2.1.5 spring boot 2.0.0.relea...

Spring Boot 事務的使用

spring boot 使用事務非常簡單,首先使用註解 enabletransactionmanagement 開啟事務支援後,然後在訪問資料庫的service方法上新增註解 transactional 便可。關於事務管理器,不管是jpa還是jdbc等都實現自介面 platformtransacti...