主頁 > 後端開發 > day08-2-Thymeleaf

day08-2-Thymeleaf

2023-03-21 22:39:22 後端開發

服務器渲染技術-Thymeleaf

1.基本介紹

官方在線檔案:Read online 檔案下載:Thymeleaf 3.1 PDF, EPUB, MOBI

Thymeleaf 是什么

  1. Thymeleaf是一個現代的服務器端Java模板引擎,適用于Web和獨立環境,能夠處理HTML,XML,JavaScript,CSS甚至純文本

  2. Thymeleaf 是一個跟 Velocity、FreeMarker 類似的模板引擎,可完全替代 JSP

  3. Thymeleaf 是一個 Java 類別庫,是一個xml/ xhtml/ html5的模板引擎,可以作為 mvc 的 web 應用的 view 層

Thymeleaf 的優點

  1. 實作 JSTL、OGNL 運算式效果,語法類似,上手快
  2. Thymeleaf 模板頁面無需服務器渲染,也可以被瀏覽器運行,頁面簡潔
  3. SpringBoot 支持 FreeMarker、Thymeleaf、Veocity

Thymeleaf 的缺點

  1. Thymeleaf 并不是一個高性能的引擎,適用于單體應用
  2. 如果要做一個高并發的應用,選擇前后分離更好,比如 Vue + SpringBoot

2.Thymeleaf機制

Thymeleaf 是服務器渲染技術,頁面資料是在服務端進行渲染的

例如:某個頁面被請求,其中有一段Thymeleaf代碼,則 thymeleaf 模板引擎完成處理之后(在服務端完成),才會將頁面結果回傳,因此使用Thymeleaf,并不是前后端分離,

3.語法

3.1運算式

1.運算式一覽

運算式名稱 語法 用途
變數取值 ${...} 獲取請求域、session域、物件等值
選擇變數 *{...} 獲取背景關系物件值
訊息 #{...} 獲取國際化等值
鏈接 @{...} 生成鏈接
片段運算式 ~{...} jsp:include 作用,引入公共頁面片段

2.字面量

文本值:'jack', 'hello', ...

數字:10, 5, 36.8, ...

布林值:true,false

空值:null

變數:name, age, ...(變數名不能有空格)

3.文本操作

字串拼接:+

變數替換:|age=${age}|

3.2運算子

1.數學運算

運算子:+,-,*,/,%

2.布爾運算

運算子:and,or

一元運算:!,not

3.比較運算

比較:>,<,>=,<=(gt,lt,ge,le)

等式:==,!=(eq,ne)

4.條件運算

If-then:(if)?(then)

If-then-else:(if)?(then):(else)

Default:(value)?:(defaultvalue)

3.3th屬性

html有的屬性,Thymeleaf基本都有,而常用的屬性大概有七八個,其中th屬性執行的優先級從1~8,數字越小優先級越高,

  • th:fragment

    宣告代碼塊,方便被 th:insert 參考,優先級為 order=8

  • th:text

    設定當前元素的文本內容,相同功能的還有 th:utext,兩者的區別在于前者不會轉義 html 標簽,而后者會,優先級為 order=7

  • th:value

    設定當前元素的 value 值,類似修改指定屬性的還有 th:src,th:href,優先級為 order=6

  • th:attr

    修改任意屬性,實際開發中使用較少,因為有豐富的其他th屬性幫忙,類似的還有th:attrappend,th:attrprepend,優先級為 order=5

  • th:object

    宣告變數,一般和 *{} 一起配合使用,達到偷懶效果,優先級 order=4

  • th:if

    條件判斷,類似的還有 th:unless,th:switch,th:case,優先級為 order=3

  • th:each

    遍歷回圈元素,和 th:text 或 th:value 一起使用,注意該屬性修飾的標簽位置,優先級為 order=2

  • th:insert

    代碼塊引入,類似的還有 th:replace,th:include,三者的區別較大,若使用不當會破壞html結構,當用于公共代碼塊提取的場景,優先級為 order=1

3.4迭代

教程:使用百里香葉 (thymeleaf.org)

在前端頁面中,總是出現需要遍歷集合中的元素以展示所有資訊的場景,Thymeleaf標準方言為我們提供了一個有用的屬性:th:each

假設后臺控制器添加了一個商品串列的屬性 prods,然后,我們使用 th:each 在模板中使用來遍歷產品串列:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
  <head>
    <title>Good Thymes Virtual Grocery</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" type="text/css" media="all" 
          href="https://www.cnblogs.com/css/gtvg.css" th:href="https://www.cnblogs.com/liyuelian/p/@{/css/gtvg.css}" />
  </head>
  <body>
    <h1>Product list</h1>
  
    <table>
      <tr>
        <th>NAME</th>
        <th>PRICE</th>
        <th>IN STOCK</th>
      </tr>
      <tr th:each="prod : ${prods}">
        <td th:text="${prod.name}">Onions</td>
        <td th:text="${prod.price}">2.41</td>
        <td th:text="${prod.inStock}? #{true} : #{false}">yes</td>
      </tr>
    </table>
  
    <p>
      <a href="https://www.cnblogs.com/liyuelian/home.html" th:href="https://www.cnblogs.com/liyuelian/p/@{/}">Return to home</a>
    </p>
  </body>
</html>

prod : ${prods} 屬性的含義為:回圈 \({prods} 屬性的每一個元素,\){prods} 為被迭代變數,prod 為迭代變數,即當前回圈的元素,

需要注意的是,prod 為迭代變數的作用域為 <tr>元素,可用于其內部標記 <td>

3.5條件運算

例如:

<a href="https://www.cnblogs.com/liyuelian/p/comments.html"
   th:href="https://www.cnblogs.com/liyuelian/p/@{/product/comments(prodId=${prod.id})}" 
   th:if="${not #lists.isEmpty(prod.comments)}">view</a>

這將創建一個指向評論頁面(帶有 URL )的鏈接,并將引數設定為產品的引數,但前提是產品有任何評論,/product/comments prodId id

還有一種方法可以使用 Java 中的等效開關結構有條件地顯示內容:switch-case-default

<div th:switch="${user.role}">
  <p th:case="'admin'">User is an administrator</p>
  <p th:case="#{roles.manager}">User is a manager</p>
  <p th:case="*">User is some other thing</p>
</div>

3.6注意事項

  1. 使用Thymeleaf語法首先要宣告名稱空間:xmlns:th="http://www.thymeleaf.org"
  2. 設定文本 th:text,設定input的值用 th:value,回圈輸出用 th:each,條件判斷用 th:if,插入代碼塊用 th:insert,定義代碼塊用 th:fragment,宣告變數用 th:object
  3. th:each 的用法需要格外注意,如果你要回圈一個div中的p標簽,則 th:each 屬性必須放在p標簽上,若你將其放在div上,回圈的將是整個div
  4. 變數運算式中提供了很多的內置方法,該內置方法是用#開頭,不要和#{}混淆,

4.綜合案例

  • 需求:使用 SpringBoot+Thymeleaf 完成簡單的用戶登錄-串列功能,
    1. 如果沒有登錄就訪問管理頁面,提示非法訪問,需要登錄
    2. 如果登錄成功,顯示登錄名稱,以及用戶串列
    3. 為了簡化,這里就不連資料庫了,使用Javabean代替資料
image-20230320202638784

注意:這里的thymeleaf的templates目錄不能直接訪問,是因為SpringBoot默認可以訪問的靜態資源路徑沒有templates,因此除了上面請求轉發到資源的方法外,也可以配置靜態資源的訪問路徑:

spring:
  web:
    resources:
      static-locations: [classpath:/static/,classpath:/templates/]

或者在配置類中配置(略),

4.1代碼實作

image-20230321175639115

(1)創建 SpringBoot 專案,引入基本的庫檔案

<!--匯入SpringBoot父工程-->
<parent>
    <artifactId>spring-boot-starter-parent</artifactId>
    <groupId>org.springframework.boot</groupId>
    <version>2.5.3</version>
</parent>

<dependencies>
    <!--匯入場景啟動器-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <!--lombok-->
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-configuration-processor</artifactId>
    </dependency>

    <!--引入thymeleaf-starter:專案會自動完成配置,相關類會自動注入容器中-->
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
</dependencies>

(2)創建 login.html 和 manage.html 和靜態圖片到指定目錄(templates目錄,該目錄不能直接訪問)

login.html

<!DOCTYPE html>
<!--引入命名空間-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>登錄</title>
</head>
<body bgcolor="#CED3FE">
<div style="text-align: center">
    <h1>用戶登錄</h1>
    <hr/>
    <img src="https://img.uj5u.com/2023/03/21/343778212001523.jpg" />
    <!--th:action="@{/login}"可以替換#-->
    <form action="#" th:action="@{/login}" method="post">
        <label style="color: red" th:text="${msg}"></label><br/>
        用戶名:<input type="text" style="width: 150px" name="name"/><br/><br/>
        密 碼:<input type="password" style="width: 150px" name="password"/><br/><br/>
        <input type="submit" value="https://www.cnblogs.com/liyuelian/p/登錄"/>
        <input type="reset" value="https://www.cnblogs.com/liyuelian/p/重新填寫"/>
    </form>
</div>
</body>
</html>

manage.html

<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>管理后臺</title>
</head>
<body bgcolor="#CED3FE">
<a href="https://www.cnblogs.com/liyuelian/p/#" th:href="https://www.cnblogs.com/liyuelian/p/@{/}">安全退出</a>
<!--行內取法,使用雙層中括號-->
歡迎您:[[${session.loginAdmin.name}]]
<hr/>
<h1>管理雇員</h1>
<div style="position: center ">
    <table border="1px" cellspacing="0" bordercolor="green" style="width: 700px">
        <tr bgcolor="pink">
            <td>id</td>
            <td>name</td>
            <td>age</td>
            <td>pwd</td>
            <td>email</td>
        </tr>
        <!--回圈展示-->
        <tr bgcolor="#ffc0cb" th:each="user:${users}">
            <td th:text="${user.id}">a</td>
            <td th:text="${user.name}">b</td>
            <td th:text="${user.age}">c</td>
            <td th:text="${user.password}">d</td>
            <td th:text="${user.email}">e</td>
        </tr>
    </table>
    <br/>
</div>
<hr/>
</body>
</html>

(3)Javabean

Admin.java

package com.li.thymeleaf.bean;

import lombok.Data;

/**
 * @author 李
 * @version 1.0
 */
@Data
public class Admin {
    private String name;
    private String password;
}

User.java

package com.li.thymeleaf.bean;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @author 李
 * @version 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class User {
    private Integer id;
    private String name;
    private Integer age;
    private String password;
    private String email;
}

(4)控制器Controller

IndexController

package com.li.thymeleaf.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;

/**
 * @author 李
 * @version 1.0
 */
@Controller
public class IndexController {
    //撰寫方法,轉發到登錄頁
    @GetMapping(value = https://www.cnblogs.com/liyuelian/p/{"/", "/login"})
    public String login() {
        //因為我們引入了starter-thymeleaf,這里會直接
        //使用視圖決議到thymeleaf模板檔案下的adminLogin.html
        return "adminLogin";
    }
}

AdminController

package com.li.thymeleaf.controller;

import com.li.thymeleaf.bean.Admin;
import com.li.thymeleaf.bean.User;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;

import javax.servlet.http.HttpSession;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 李
 * @version 1.0
 */
@Controller
public class AdminController {
    /**
     * 回應用戶登錄請求
     *
     * @param admin   自定義物件引數
     * @param session 將獲取的admin資訊放入session中(登錄成功)
     * @param model   model的資料會自動放入request域中傳給下一個頁面(登錄失敗)
     * @return
     */
    @PostMapping("/login")//從請求方式區分,不會沖突
    public String login(Admin admin, HttpSession session, Model model) {
        //驗證用戶是否合法
        if (StringUtils.hasText(admin.getName()) && "666".equals(admin.getPassword())) {//合法
            //將登陸用戶保存到session中
            session.setAttribute("loginAdmin", admin);
            //應使用重定向(用請求轉發重繪頁面會重復提交表單),這里的重定向是到mainPage方法,而不是直接到頁面,
            return "redirect:manage.html";
        } else {//不合法,回傳重新登錄
            model.addAttribute("msg", "用戶名或密碼錯誤!");
            return "adminLogin";
        }
    }

    //處理用戶請求到manage.html
    @GetMapping("/manage.html")
    public String mainPage(Model model, HttpSession session) {
        //先校驗(這里暫時使用session驗證,后面可以統一使用攔截器)
        Object loginAdmin = session.getAttribute("loginAdmin");
        if (loginAdmin != null) {//說明登陸過
            //模擬用戶資料
            List<User> users = new ArrayList<>();
            users.add(new User(1, "關羽", 555, "1234", "[email protected]"));
            users.add(new User(2, "張飛", 455, "12345", "[email protected]"));
            users.add(new User(3, "趙云", 344, "12346", "[email protected]"));
            users.add(new User(4, "馬超", 300, "12347", "[email protected]"));
            users.add(new User(5, "黃忠", 666, "12348", "[email protected]"));
            //放入到request域中(model中的資料會自動放入到request域中)
            model.addAttribute("users", users);
            return "manage";//這里才是真正視圖決議到 templates/manage.html
        } else {//說明沒有登錄過,拒絕訪問manage頁面
            model.addAttribute("msg", "你沒有登錄/請登錄!");
            return "adminLogin";
        }
    }
}

(5)啟動類

package com.li.thymeleaf;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

/**
 * @author 李
 * @version 1.0
 */
@SpringBootApplication
public class Application {
    public static void main(String[] args) {
        SpringApplication.run(Application.class,args);
    }
}

(6)測驗

  • 未經登錄直接訪問manage.html
thymeleaf-應用案例之測驗一
  • 登錄測驗
thymeleaf-應用案例之測驗二

4.2練習

  1. 把前面接收引數相關注解、自定義轉換器、處理JSON、內容協商相關代碼和案例過一遍

  2. 將Thymeleaf用戶管理改為妖怪串列,欄位做相應的改變,進行練習

    • Monster [id,name,skill,age,salary,birth]

轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/547616.html

標籤:Java

上一篇:Maven 中<optional>true</optional>和<scope>provided</scope>之間的區別

下一篇:C++入門

標籤雲
其他(157675) Python(38076) JavaScript(25376) Java(17977) C(15215) 區塊鏈(8255) C#(7972) AI(7469) 爪哇(7425) MySQL(7132) html(6777) 基礎類(6313) sql(6102) 熊猫(6058) PHP(5869) 数组(5741) R(5409) Linux(5327) 反应(5209) 腳本語言(PerlPython)(5129) 非技術區(4971) Android(4554) 数据框(4311) css(4259) 节点.js(4032) C語言(3288) json(3245) 列表(3129) 扑(3119) C++語言(3117) 安卓(2998) 打字稿(2995) VBA(2789) Java相關(2746) 疑難問題(2699) 细绳(2522) 單片機工控(2479) iOS(2429) ASP.NET(2402) MongoDB(2323) 麻木的(2285) 正则表达式(2254) 字典(2211) 循环(2198) 迅速(2185) 擅长(2169) 镖(2155) 功能(1967) .NET技术(1958) Web開發(1951) python-3.x(1918) HtmlCss(1915) 弹簧靴(1913) C++(1909) xml(1889) PostgreSQL(1872) .NETCore(1853) 谷歌表格(1846) Unity3D(1843) for循环(1842)

熱門瀏覽
  • 【C++】Microsoft C++、C 和匯編程式檔案

    ......

    uj5u.com 2020-09-10 00:57:23 more
  • 例外宣告

    相比于斷言適用于排除邏輯上不可能存在的狀態,例外通常是用于邏輯上可能發生的錯誤。 例外宣告 Item 1:當函式不可能拋出例外或不能接受拋出例外時,使用noexcept 理由 如果不打算拋出例外的話,程式就會認為無法處理這種錯誤,并且應當盡早終止,如此可以有效地阻止例外的傳播與擴散。 示例 //不可 ......

    uj5u.com 2020-09-10 00:57:27 more
  • Codeforces 1400E Clear the Multiset(貪心 + 分治)

    鏈接:https://codeforces.com/problemset/problem/1400/E 來源:Codeforces 思路:給你一個陣列,現在你可以進行兩種操作,操作1:將一段沒有 0 的區間進行減一的操作,操作2:將 i 位置上的元素歸零。最終問:將這個陣列的全部元素歸零后操作的最少 ......

    uj5u.com 2020-09-10 00:57:30 more
  • UVA11610 【Reverse Prime】

    本人看到此題沒有翻譯,就附帶了一個自己的翻譯版本 思考 這一題,它的第一個要求是找出所有 $7$ 位反向質數及其質因數的個數。 我們應該需要質數篩篩選1~$10^{7}$的所有數,這里就不慢慢介紹了。但是,重讀題,我們突然發現反向質數都是 $7$ 位,而將它反過來后的數字卻是 $6$ 位數,這就說明 ......

    uj5u.com 2020-09-10 00:57:36 more
  • 統計區間素數數量

    1 #pragma GCC optimize(2) 2 #include <bits/stdc++.h> 3 using namespace std; 4 bool isprime[1000000010]; 5 vector<int> prime; 6 inline int getlist(int ......

    uj5u.com 2020-09-10 00:57:47 more
  • C/C++編程筆記:C++中的 const 變數詳解,教你正確認識const用法

    1、C中的const 1、區域const變數存放在堆疊區中,會分配記憶體(也就是說可以通過地址間接修改變數的值)。測驗代碼如下: 運行結果: 2、全域const變數存放在只讀資料段(不能通過地址修改,會發生寫入錯誤), 默認為外部聯編,可以給其他源檔案使用(需要用extern關鍵字修飾) 運行結果: ......

    uj5u.com 2020-09-10 00:58:04 more
  • 【C++犯錯記錄】VS2019 MFC添加資源不懂如何修改資源宏ID

    1. 首先在資源視圖中,添加資源 2. 點擊新添加的資源,復制自動生成的ID 3. 在解決方案資源管理器中找到Resource.h檔案,編輯,使用整個專案搜索和替換的方式快速替換 宏宣告 4. Ctrl+Shift+F 全域搜索,點擊查找全部,然后逐個替換 5. 為什么使用搜索替換而不使用屬性視窗直 ......

    uj5u.com 2020-09-10 00:59:11 more
  • 【C++犯錯記錄】VS2019 MFC不懂的批量添加資源

    1. 打開資源頭檔案Resource.h,在其中預先定義好宏 ID(不清楚其實ID值應該設定多少,可以先新建一個相同的資源項,再在這個資源的ID值的基礎上遞增即可) 2. 在資源視圖中選中專案資源,按F7編輯資源檔案,按 ID 型別 相對路徑的形式添加 資源。(別忘了先把檔案拷貝到專案中的res檔案 ......

    uj5u.com 2020-09-10 01:00:19 more
  • C/C++編程筆記:關于C++的參考型別,專供新手入門使用

    今天要講的是C++中我最喜歡的一個用法——參考,也叫別名。 參考就是給一個變數名取一個變數名,方便我們間接地使用這個變數。我們可以給一個變數創建N個參考,這N + 1個變數共享了同一塊記憶體區域。(參考型別的變數會占用記憶體空間,占用的記憶體空間的大小和指標型別的大小是相同的。雖然參考是一個物件的別名,但 ......

    uj5u.com 2020-09-10 01:00:22 more
  • 【C/C++編程筆記】從頭開始學習C ++:初學者完整指南

    眾所周知,C ++的學習曲線陡峭,但是花時間學習這種語言將為您的職業帶來奇跡,并使您與其他開發人員區分開。您會更輕松地學習新語言,形成真正的解決問題的技能,并在編程的基礎上打下堅實的基礎。 C ++將幫助您養成良好的編程習慣(即清晰一致的編碼風格,在撰寫代碼時注釋代碼,并限制類內部的可見性),并且由 ......

    uj5u.com 2020-09-10 01:00:41 more
最新发布
  • Rust中的智能指標:Box<T> Rc<T> Arc<T> Cell<T> RefCell<T> Weak

    Rust中的智能指標是什么 智能指標(smart pointers)是一類資料結構,是擁有資料所有權和額外功能的指標。是指標的進一步發展 指標(pointer)是一個包含記憶體地址的變數的通用概念。這個地址參考,或 ” 指向”(points at)一些其 他資料 。參考以 & 符號為標志并借用了他們所 ......

    uj5u.com 2023-04-20 07:24:10 more
  • Java的值傳遞和參考傳遞

    值傳遞不會改變本身,參考傳遞(如果傳遞的值需要實體化到堆里)如果發生修改了會改變本身。 1.基本資料型別都是值傳遞 package com.example.basic; public class Test { public static void main(String[] args) { int ......

    uj5u.com 2023-04-20 07:24:04 more
  • [2]SpinalHDL教程——Scala簡單入門

    第一個 Scala 程式 shell里面輸入 $ scala scala> 1 + 1 res0: Int = 2 scala> println("Hello World!") Hello World! 檔案形式 object HelloWorld { /* 這是我的第一個 Scala 程式 * 以 ......

    uj5u.com 2023-04-20 07:23:58 more
  • 理解函式指標和回呼函式

    理解 函式指標 指向函式的指標。比如: 理解函式指標的偽代碼 void (*p)(int type, char *data); // 定義一個函式指標p void func(int type, char *data); // 宣告一個函式func p = func; // 將指標p指向函式func ......

    uj5u.com 2023-04-20 07:23:52 more
  • Django筆記二十五之資料庫函式之日期函式

    本文首發于公眾號:Hunter后端 原文鏈接:Django筆記二十五之資料庫函式之日期函式 日期函式主要介紹兩個大類,Extract() 和 Trunc() Extract() 函式作用是提取日期,比如我們可以提取一個日期欄位的年份,月份,日等資料 Trunc() 的作用則是截取,比如 2022-0 ......

    uj5u.com 2023-04-20 07:23:45 more
  • 一天吃透JVM面試八股文

    什么是JVM? JVM,全稱Java Virtual Machine(Java虛擬機),是通過在實際的計算機上仿真模擬各種計算機功能來實作的。由一套位元組碼指令集、一組暫存器、一個堆疊、一個垃圾回收堆和一個存盤方法域等組成。JVM屏蔽了與作業系統平臺相關的資訊,使得Java程式只需要生成在Java虛擬機 ......

    uj5u.com 2023-04-20 07:23:31 more
  • 使用Java接入小程式訂閱訊息!

    更新完微信服務號的模板訊息之后,我又趕緊把微信小程式的訂閱訊息給實作了!之前我一直以為微信小程式也是要企業才能申請,沒想到小程式個人就能申請。 訊息推送平臺🔥推送下發【郵件】【短信】【微信服務號】【微信小程式】【企業微信】【釘釘】等訊息型別。 https://gitee.com/zhongfuch ......

    uj5u.com 2023-04-20 07:22:59 more
  • java -- 緩沖流、轉換流、序列化流

    緩沖流 緩沖流, 也叫高效流, 按照資料型別分類: 位元組緩沖流:BufferedInputStream,BufferedOutputStream 字符緩沖流:BufferedReader,BufferedWriter 緩沖流的基本原理,是在創建流物件時,會創建一個內置的默認大小的緩沖區陣列,通過緩沖 ......

    uj5u.com 2023-04-20 07:22:49 more
  • Java-SpringBoot-Range請求頭設定實作視頻分段傳輸

    老實說,人太懶了,現在基本都不喜歡寫筆記了,但是網上有關Range請求頭的文章都太水了 下面是抄的一段StackOverflow的代碼...自己大修改過的,寫的注釋挺全的,應該直接看得懂,就不解釋了 寫的不好...只是希望能給視頻網站開發的新手一點點幫助吧. 業務場景:視頻分段傳輸、視頻多段傳輸(理 ......

    uj5u.com 2023-04-20 07:22:42 more
  • Windows 10開發教程_編程入門自學教程_菜鳥教程-免費教程分享

    教程簡介 Windows 10開發入門教程 - 從簡單的步驟了解Windows 10開發,從基本到高級概念,包括簡介,UWP,第一個應用程式,商店,XAML控制元件,資料系結,XAML性能,自適應設計,自適應UI,自適應代碼,檔案管理,SQLite資料庫,應用程式到應用程式通信,應用程式本地化,應用程式 ......

    uj5u.com 2023-04-20 07:22:35 more