色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

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

springBoot加入thymeleaf模板的方式

瀏覽:2日期: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
相關文章:
主站蜘蛛池模板: 亚洲人成一区二区三区 | 免费看a网站 | 亚洲图片偷拍区 | 91麻精品国产91久久久久 | 亚洲欧美日韩精品久久 | 狼人青草久久网尹人 | 日本欧美久久久久免费播放网 | 三级视频在线播放 | 日韩一区二区不卡 | 国产a级特黄的片子视频免费 | 日韩毛片欧美一级a | 欧美一级特黄做 | 中国成人在线视频 | 91精品一区国产高清在线 | 午夜两性试爱视频免费 | 男人女人做黄刺激性视频免费 | 毛片无码国产 | 久久久免费网站 | 不卡一区在线观看 | 99国产精品热久久久久久夜夜嗨 | 国内自拍欧美 | 一区二区三区日本视频 | 亚洲成人影院在线观看 | 国产玖玖视频 | 国产亚洲人成网站在线观看不卡 | 三级毛片在线播放 | 成人免费久久精品国产片久久影院 | 亚洲理论欧美理论在线观看 | 亚洲欧洲国产成人综合一本 | 91精品一区二区三区在线观看 | 国产视频软件在线 | 亚洲精品在线免费观看视频 | 亚洲第一区香蕉_国产a | 日本一级特黄特色大片免费视频 | 手机看片av | 亚洲欧美小视频 | 91九色国产porny | 免费精品99久久国产综合精品 | 久久se精品一区二区国产 | 中文字幕在线欧美 | 91亚洲精品一区二区福利 |