国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

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

springBoot加入thymeleaf模板的方式

瀏覽:3日期: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
相關文章:
主站蜘蛛池模板: 成人欧美一区二区三区黑人 | 92精品国产自产在线观看 | 成人精品视频在线观看播放 | 国产情侣普通话刺激对白 | 亚洲精品成人久久久影院 | 欧美久久久久久久一区二区三区 | 国产精品99久久久久久宅男 | 久草三级 | 99视频免费观看 | 日本在线免费观看视频 | 欧美性色高清生活片 | 日本乱子伦xxxx | 亚洲另类在线视频 | 精品视频国产狼人视频 | 午夜无遮挡怕怕怕免费视频 | 欧美在线观看成人高清视频 | 国产精品久草 | 国产在线成人精品 | 免费区一级欧美毛片 | 亚洲国产精品欧美日韩一区二区 | ab毛片| 玖玖精品在线 | 国产一区曰韩二区欧美三区 | 欧美成人久久久免费播放 | 免费观看日本特色做爰视频在线 | 国产高清精品自在线看 | 在线综合+亚洲+欧美中文字幕 | 一级毛片在线完整免费观看 | 成人福利在线 | 欧美大片毛片aaa免费看 | 免费高清一级欧美片在线观看 | 成人国产精品 | 精品一区二区三区在线成人 | 中文字幕有码在线播放 | 亚州综合| 国产美女一级毛片 | 男女乱配视频免费观看 | 久久精品国产一区二区三区不卡 | 色婷婷激婷婷深爱五月老司机 | 一级做a爱久久久久久久 | 免费网站看v片在线香蕉 |