亚洲免费在线视频-亚洲啊v-久久免费精品视频-国产精品va-看片地址-成人在线视频网

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

springBoot加入thymeleaf模板的方式

瀏覽:5日期: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
相關文章:
主站蜘蛛池模板: 欧美13一14sexvideo欧 | 国产在亚洲线视频观看 | 亚洲精品午夜在线观看 | 中文字幕一区二区在线观看 | 男人天堂avav | 亚洲欧美自拍一区 | 亚洲午夜a| 久久精品国产亚洲a | 国产高清视频在线 | 欧美成人ass| 国产资源精品一区二区免费 | 亚洲成a人片在线观看中文 亚洲成a人片在线观看中文!!! | 午夜精品久视频在线观看 | 亚洲免费成人在线 | 国产精品爱久久久久久久小 | 亚洲国产精品一区二区九九 | 国产亚洲欧美日韩综合综合二区 | 自拍视频在线 | 亚洲理论欧美理论在线观看 | 美女黄18 | 亚洲国产日韩欧美综合久久 | 亚洲va久久久噜噜噜久久狠狠 | 亚洲国产精品一区二区久 | 伊人久久青草青青综合 | 国产日韩欧美精品在线 | 久久久久久久久久久9精品视频 | 亚欧美图片自偷自拍另类 | 美女被男人桶到嗷嗷叫爽网站 | 国产一区二区三区成人久久片 | 国产综合在线视频 | 欧美激情伦妇在线观看 | 国产日韩欧美一区二区 | 波多野吉衣 免费一区 | 免费的成人a视频在线观看 免费的毛片 | 国产主播大尺度精品福利 | 精品91一区二区三区 | 91久久国产精品 | 国产免费自拍视频 | 亚洲美女网址 | 亚洲人成在线影院 | 国产人妖xxxx做受视频 |