thymeleaf 模板引擎 的迴圈讀取

2021-09-11 08:27:09 字數 488 閱讀 2742

1.pom檔案中加入 thymeleaf  的jar

org.springframework.boot

spring-boot-starter-thymeleaf

在templates下建立乙個html檔案

3.html**如下

注意:xmlns:th=""  這是引入 thymeleaf 的標籤庫

後台傳過來的值如下:

前台迴圈讀取後台的值:

$代表後台傳過來的值,

user是$ 他的別名

獲得他的文字user.id

thymeleaf模板引擎

thymeleaf 模組引擎類似於jsp的el表示式 1.引入thymeleaf org.springframework.boot spring boot starter thymeleaf 3.0.11.release 2.1.1 2.thymeleaf的使用 語法只要我們把html檔案放在cla...

thymeleaf引擎模板公共頁面抽取

1 抽取公共片段 2 引入公共片段 模板名 選擇器 模板名 片段名3 預設效果 insert的公共片段在div標籤中 如果使用th insert等屬性進行引入,可以不用寫 行內寫法可以加上 三種引入公共片段的th屬性 th insert 將公共片段整個插入到宣告引入的元素中 th replace 將...

一起學習thymeleaf模板引擎

簡單說,thymeleaf 是乙個跟 velocity freemarker 類似的模板引擎,它可以完全替代 jsp 相較與其他的模板引擎,它有如下三個極吸引人的特點 1.thymeleaf 在有網路和無網路的環境下皆可執行,即它可以讓美工在瀏覽器檢視頁面的靜態效果,也可以讓程式設計師在伺服器檢視帶...