大战熟女丰满人妻av-荡女精品导航-岛国aaaa级午夜福利片-岛国av动作片在线观看-岛国av无码免费无禁网站-岛国大片激情做爰视频

專注Java教育14年 全國咨詢/投訴熱線:400-8080-105
動力節點LOGO圖
始于2009,口口相傳的Java黃埔軍校
首頁 學習攻略 Java學習 新課上線,動力節點Thymeleaf服務器模板引擎

新課上線,動力節點Thymeleaf服務器模板引擎

更新時間:2021-05-17 14:12:52 來源:動力節點 瀏覽1942次

Thymeleaf 是一款用于渲染 XML/XHTML/HTML5 內容的模板引擎。它類似我們之前使用的 JSP、FreeMaker 等模版,它也可以輕易與 Spring MVC 等 Web 框架進行集成作為 Web 應用的模板引擎。同時Thymeleaf得到了Spring Boot官方對的推薦使用,同時也是未來的一個趨勢。

Thymeleaf服務器

與其它模板引擎相比,Thymeleaf最大的特點是能夠直接在瀏覽器中打開并正確顯示模板頁面,而不需要啟動整個Web應用。

Thymeleaf的優勢在于

1. 以html的屬性出現,保證html的完整語法結構不被破壞;

2. 瀏覽器可直接預覽模板文件,無需服務器端支持;

3. 提供了大量內置對象,內置工具類;

4. 語法簡單,學習難度低;

5. 支持html,js,raw等多種模板類型;

Thymeleaf快速入門

1. 在使用Thymeleaf之前,首先在pom.xml文件導入依賴

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

2. resource目錄下的templates目錄新建一個html頁面test.html(另外Thymeleaf默認的頁面文件后綴是.html)

編寫controller層

package com.markjava.controller;import org.springframework.stereotype.Controller;import org.springframework.ui.Model;import org.springframework.web.bind.annotation.RequestMapping;@Controllerpublic class UserController {@RequestMapping("/hello") public String test(Model model) { model.addAttribute("name","MarkerJava"); return "test"; }

然后打開瀏覽器訪問localhost:8080/hello運行會獲取到MarkerJava

注:

th:text在th后面加上一個冒號,并附加特定的字符組合,這個thymeleaf定義的占位符是構建thymeleaf頁面的基礎。

th:text="${name}"中的${}是個占位符${}是個占位符

如果大家還是沒有看懂,不太了解的話,可以跟著動力節點的Thymeleaf基礎教程來學習,這樣更能直觀的了解,從課程適合在后臺應用,以及各種管理類系統中使用。帶你一步一步詳解講解Thymeleaf模板引擎技術,全面掌握Thymeleaf模板技術,并在實際項目開發中得心應手使用Thymeleaf模板技術。

 課程目錄:

課程目錄:

第一章Thymeleaf小試牛刀

1-1 thymeleaf-模板工作方式

1-2 thymeleaf-文檔

1-3 thymeleaf-第一個例子

1-4 thymeleaf-模板使用數據

1-5 thymeleaf-使用模板文件

1-6 thymeleaf-設置模板前綴后綴

1-7 thymeleaf-springboot環境搭建

1-8 thymeleaf-測試springboot中使用模板

第二章Thymeleaf語法

2-1 thymeleaf-變量表達式基本語法-1

2-2 thymeleaf-變量表達式基本語法-2

2-3 thymeleaf-鏈接表達式

2-4 thymeleaf-鏈接表達式傳參數

2-5 thymeleaf-國際化介紹

2-6 thymeleaf-自定義LocalResolver

2-7 thymeleaf-國際化模板定義

2-8 thymeleaf-調式國際化

2-9 thymeleaf-文本表達式

2-10 thymeleaf-數字表達式

2-11 thymeleaf-布爾表達式

2-12 thymeleaf-null和空字符串

2-13 thymeleaf-邏輯表達式

2-14 thymeleaf-三元運算符-1

2-15 thymeleaf-三元運算符-2

2-16 thymeleaf-設置屬性值

2-17 thymeleaf-attr設置任意屬性值

2-18 thymeleaf-設置屬性值

2-19 thymeleaf-同時設置多個屬性值

2-20 thymeleaf-boolean設置

2-21 thymeleaf-設置標簽體文本

2-22 thymeleaf-循環each(1)

2-23 thymeleaf-each循環普通Map

2-24 thymeleaf-each循環ListMap

2-25 thymeleaf-each循環數組

2-26 thymeleaf-each循環給Select組件添加數據

2-27 thymeleaf-each循環的狀態變量

2-28 thymeleaf-if使用

2-29 thymeleaf-unless使用

第三章Thymeleaf模板引用

3-1 thymeleaf-模版的介紹

3-2 thymeleaf-模版insert使用

3-3 thymeleaf-函數模版和當前頁面中定義模版

3-4 thymeleaf-使用id引用模版

3-5 thymeleaf-replace和include的對比

3-6 thymeleaf-常用insert-replace

3-7 thymeleaf-re刪除

3-8 thymeleaf-re其它的范圍值

3-9 thymeleaf-動態指定模版名稱

3-10 thymeleaf-inline在js中獲取數據

3-11 thymeleaf-inline和text的比較使用

3-12 thymeleaf-禁用內聯

3-13 thymeleaf-局部變量

第四章Thymeleaf內置對象

4-1 thymeleaf-內置工具類

4-2 thymeleaf-內置工具類日期和string

4-3 thymeleaf-內置對象#request

4-4 thymeleaf-內置對象#session和#servletContext

4-5 thymeleaf-快捷對象param

4-6 thymeleaf-快捷對象session和application

還處于初學者的同學,能力上可能還學不到這些,不過沒關系,動力節點還有針對初學者進階準備了其它適合的Java視頻課程,等你跟上進度后,在看這套教程就非常簡單,好學啦。

提交申請后,顧問老師會電話與您溝通安排學習

免費課程推薦 >>
技術文檔推薦 >>
主站蜘蛛池模板: 久久综合香蕉久久久久久久 | ww.久久| 男女啪啪猛烈免费网站 | 起碰成人免费公开网视频 | 中文字幕久热精品视频免费 | 情欲综合网 | 亚洲一区二区三区网站 | 狠狠色噜噜狠狠狠狠狠色综合久久 | 中文字幕国产视频 | 日日射夜夜操 | 和日本免费不卡在线v | 日本老太做爰xx | 欧美性xxxxxx爱 | 日本一本不卡 | 成人欧美精品大91在线 | 99久久精品毛片免费播放 | 亚洲综合在线播放 | 网友自拍视频悠悠在线 | 国产精品久久久久久免费 | 久久99热精品免费观看 | 视频在线观看入口一二三2021 | 亚洲精品综合一区在线 | 欧美一区二区三区在线视频 | 久久96国产精品久久久 | 在线播放国产一区二区三区 | 美女视频免费在线观看 | 一级女性全黄生活片看看 | 伊人久久精品午夜 | 午夜操一操| 国产精品100页 | 普通话对白国产情侣自啪 | 日韩在线观看视频网站 | 伦理一区二区 | 久久6国产 | 亚洲另类精品综合 | 国产精品午夜激爽毛片 | 97国产免费全部免费观看 | 成年人黄视频大全 | 玖玖精品国产 | 欧美日韩综合精品一区二区三区 | 国产ar高清视频+视频 |