av一区二区在线观看_亚洲男人的天堂网站_日韩亚洲视频_在线成人免费_欧美日韩精品免费观看视频_久草视

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

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模板內容請搜索好吧啦網以前的文章或繼續(xù)瀏覽下面的相關文章希望大家以后多多支持好吧啦網!

標簽: Spring
相關文章:
主站蜘蛛池模板: 日韩欧美一区二区三区免费看 | 中文字幕视频在线观看 | 草久视频 | 精品国产一区二区三区性色 | 福利社午夜影院 | av一二三四| 成人精品在线观看 | 国产精品成人一区二区三区夜夜夜 | 99免费精品视频 | 亚洲国产成人av好男人在线观看 | 久久男人 | 久久高清| 亚洲一区久久 | caoporon| 国产成人精品午夜 | 仙人掌旅馆在线观看 | 亚洲一区 | 国产成人高清 | 免费视频二区 | h在线看 | 特黄毛片 | eeuss国产一区二区三区四区 | 天天摸天天看 | 特级生活片 | 日韩和的一区二区 | 国产成人一区二区 | julia中文字幕久久一区二区 | 99综合在线 | 欧洲亚洲一区 | 国产在线一区二区三区 | 亚洲一区二区三区在线 | 国产精品99久久久久久久久久久久 | 久久亚洲综合 | 99精品一区二区 | 欧美一区二区三区视频在线 | 国产精品1区 | 欧美xxxx黑人又粗又长 | 在线一区二区三区 | 色婷婷久久久亚洲一区二区三区 | 国产91久久精品一区二区 | 国产精品视频一区二区三区, |