午夜剧场伦理_日本一道高清_国产又黄又硬_91黄色网战_女同久久另类69精品国产_妹妹的朋友在线

您的位置:首頁技術文章
文章詳情頁

springBoot加入thymeleaf模板的方式

瀏覽:32日期:2023-04-17 16:06:08

1.新建springBoot項目

在前面有兩種方式

2.加入thymeleaf模板引擎

SpringBoot推薦使用thymeleaf模板引擎語法簡單,功能更強大要想引入thymeleaf,只需要在pom,xml文件中加入如下依賴就可以了

springBoot加入thymeleaf模板的方式

<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId></dependency>

3.在controller中定義跳轉的頁面

springBoot加入thymeleaf模板的方式

會自動去templates文件夾下去找index.html

springBoot加入thymeleaf模板的方式

4.運行,然后訪問項目

輸入http://localhost:8080/testThymeleaf即可訪問index.html

springBoot加入thymeleaf模板的方式

5.在html頁面中加入thymeleaf模板標簽所需的命名空間

springBoot加入thymeleaf模板的方式

<!DOCTYPE html><html lang='en' xmlns:th='http://www.thymeleaf.org'><head> <meta charset='UTF-8'> <title>測試thymeleaf模板</title></head><body>歡迎來到測試thymeleaf界面</body></html>

6.將controller數據通過thymeleaf標簽傳到前端界面

把數據放在controller的map中

springBoot加入thymeleaf模板的方式

前端通過標簽取出數據

springBoot加入thymeleaf模板的方式

顯示效果

springBoot加入thymeleaf模板的方式

6.thymeleaf標簽語法

官方文檔https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.pdfthymeleaf中文https://raledong.gitbooks.io/using-thymeleaf/content/Chapter1/section1.1.html

常用標簽介紹

springBoot加入thymeleaf模板的方式

springBoot加入thymeleaf模板的方式springBoot加入thymeleaf模板的方式

到此這篇關于springBoot加入thymeleaf模板的方式的文章就介紹到這了,更多相關springBoot thymeleaf模板內容請搜索好吧啦網以前的文章或繼續瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
主站蜘蛛池模板: 国产成人一级片 | 国精产品99永久一区一区 | 婷婷五月色综合 | 四虎永久免费在线 | 亚洲手机视频 | 在线观看一二三区 | 日韩经典一区二区 | 在线激情网站 | 成人福利在线观看 | 在线观看成人网 | 在线观看h | 亚洲天堂不卡 | 深夜精品福利 | 日本在线国产 | 日韩中文字幕有码 | 亚洲国产精品99久久 | 五月婷久久| 国产激情综合 | 国产日韩在线观看一区 | 国产成人亚洲欧洲在线 | 午夜爆操| 久久久精品免费观看 | 欧美成人二区 | 欧美成人精品欧美一级乱黄 | 中国妇女裸体交性大片 | 久久久久久久久久久久久久 | 久久综合精品视频 | 日韩一区二区三区在线 | 日本天堂视频 | 另类天堂av | 免费在线成人网 | 俺去俺来也在线www色官网 | 久久国产精品视频 | 国产亚洲欧美视频 | 美女网站在线 | 天天射寡妇射 | 日本va欧美va欧美va精品 | 日韩一区二区三区在线播放 | av国语| 一级片视频免费看 | 国产传媒一区二区三区 |