Thymeleaf3語法詳解
Thymeleaf是Spring boot推薦使用的模版引擎,除此之外常見的還有Freemarker和Jsp。Jsp應該是我們最早接觸的模版引擎。而Freemarker工作中也很常見(Freemarker教程)。今天我們從三個方面學習Thymeleaf的語法:有常見的TH屬性,四種標准表達式用法,在SpringBoot中的應用。還在等什么,一起來學吧!
技術:Thymeleaf,SpringBoot
說明:為突出Thymeleaf3的語法知識,文章只提出與Thymeleaf有關的代碼,完整代碼請異步github,喜歡的朋友可以點個star,蟹蟹!
源碼:https://github.com/ITDragonBlog/daydayup/tree/master/Thymeleaf/spring-boot-thymeleaf
好文推薦: http://www.cnblogs.com/itdragon/p/8709948.html
文章目錄結構:
一、th屬性
常用th屬性解讀
html有的屬性,Thymeleaf基本都有,而常用的屬性大概有七八個。其中th屬性執行的優先級從1~8,數字越低優先級越高。
一、th:text :設置當前元素的文本內容,相同功能的還有th:utext,兩者的區別在於前者不會轉義html標簽,后者會。優先級不高:order=7
二、th:value:設置當前元素的value值,類似修改指定屬性的還有th:src,th:href。優先級不高:order=6
三、th:each:遍歷循環元素,和th:text或th:value一起使用。注意該屬性修飾的標簽位置,詳細往后看。優先級很高:order=2
四、th:if:條件判斷,類似的還有th:unless,th:switch,th:case。優先級較高:order=3
五、th:insert:代碼塊引入,類似的還有th:replace,th:include,三者的區別較大,若使用不恰當會破壞html結構,常用於公共代碼塊提取的場景。優先級最高:order=1
六、th:fragment:定義代碼塊,方便被th:insert引用。優先級最低:order=8
七、th:object:聲明變量,一般和*{}一起配合使用,達到偷懶的效果。優先級一般:order=4
八、th:attr:修改任意屬性,實際開發中用的較少,因為有豐富的其他th屬性幫忙,類似的還有th:attrappend,th:attrprepend。優先級一般:order=5
常用th屬性使用
使用Thymeleaf屬性需要注意點以下五點:
一、若要使用Thymeleaf語法,首先要聲明名稱空間: xmlns:th="http://www.thymeleaf.org"
二、設置文本內容 th:text,設置input的值 th:value,循環輸出 th:each,條件判斷 th:if,插入代碼塊 th:insert,定義代碼塊 th:fragment,聲明變量 th:object
三、th:each 的用法需要格外注意,打個比方:如果你要循環一個div中的p標簽,則th:each屬性必須放在p標簽上。若你將th:each屬性放在div上,則循環的是將整個div。
四、變量表達式中提供了很多的內置方法,該內置方法是用#開頭,請不要與#{}消息表達式弄混。
五、th:insert,th:replace,th:include 三種插入代碼塊的效果相似,但區別很大。
<!DOCTYPE html>
<!--名稱空間-->
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>Thymeleaf 語法</title>
</head>
<body>
<h2>ITDragon Thymeleaf 語法</h2>
<!--th:text 設置當前元素的文本內容,常用,優先級不高-->
<p th:text="${thText}" />
<p th:utext="${thUText}" />
<!--th:value 設置當前元素的value值,常用,優先級僅比th:text高-->
<input type="text" th:value="${thValue}" />
<!--th:each 遍歷列表,常用,優先級很高,僅此於代碼塊的插入-->
<!--th:each 修飾在div上,則div層重復出現,若只想p標簽遍歷,則修飾在p標簽上-->
<div th:each="message : ${thEach}"> <!-- 遍歷整個div-p,不推薦-->
<p th:text="${message}" />
</div>
<div> <!--只遍歷p,推薦使用-->
<p th:text="${message}" th:each="message : ${thEach}" />
</div>
<!--th:if 條件判斷,類似的有th:switch,th:case,優先級僅次於th:each, 其中#strings是變量表達式的內置方法-->
<p th:text="${thIf}" th:if="${not #strings.isEmpty(thIf)}"></p>
<!--th:insert 把代碼塊插入當前div中,優先級最高,類似的有th:replace,th:include,~{} :代碼塊表達式 -->
<div th:insert="~{grammar/common::thCommon}"></div>
<!--th:object 聲明變量,和*{} 一起使用-->
<div th:object="${thObject}">
<p>ID: <span th:text="*{id}" /></p><!--th:text="${thObject.id}"-->
<p>TH: <span th:text="*{thName}" /></p><!--${thObject.thName}-->
<p>DE: <span th:text="*{desc}" /></p><!--${thObject.desc}-->
</div>
</body>
</html>
后台給負責給變量賦值,和跳轉頁面。
import com.itdragon.entities.ThObject;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
@Controller
public class ThymeleafController {
@RequestMapping("thymeleaf")
public String thymeleaf(ModelMap map) {
map.put("thText", "th:text 設置文本內容 <b>加粗</b>");
map.put("thUText", "th:utext 設置文本內容 <b>加粗</b>");
map.put("thValue", "thValue 設置當前元素的value值");
map.put("thEach", Arrays.asList("th:each", "遍歷列表"));
map.put("thIf", "msg is not null");
map.put("thObject", new ThObject(1L, "th:object", "用來偷懶的th屬性"));
return "grammar/thymeleaf";
}
}
二、標准表達式語法
${...}
變量表達式,Variable Expressions
@{...}
鏈接表達式,Link URL Expressions
#{...}
消息表達式,Message Expressions
~{...}
代碼塊表達式,Fragment Expressions
*{...}
選擇變量表達式,Selection Variable Expressions
變量表達式使用頻率最高,其功能也是非常的豐富。所以我們先從簡單的代碼塊表達式開始,然后是消息表達式,再是鏈接表達式,最后是變量表達式,隨帶介紹選擇變量表達式。
~{...} 代碼塊表達式
支持兩種語法結構
推薦:~{templatename::fragmentname}
支持:~{templatename::#id}
templatename:模版名,Thymeleaf會根據模版名解析完整路徑:/resources/templates/templatename.html,要注意文件的路徑。
fragmentname:片段名,Thymeleaf通過th:fragment聲明定義代碼塊,即:th:fragment="fragmentname"
id:HTML的id選擇器,使用時要在前面加上#號,不支持class選擇器。
代碼塊表達式的使用
代碼塊表達式需要配合th屬性(th:insert,th:replace,th:include)一起使用。
th:insert:將代碼塊片段整個插入到使用了th:insert的HTML標簽中,
th:replace:將代碼塊片段整個替換使用了th:replace的HTML標簽中,
th:include:將代碼塊片段包含的內容插入到使用了th:include的HTML標簽中,
用一個官方例子來區分三者的不同,第三部分會通過實戰再次用到該知識。
<!--th:fragment定義代碼塊標識-->
<footer th:fragment="copy">
© 2011 The Good Thymes Virtual Grocery
</footer>
<!--三種不同的引入方式-->
<div th:insert="footer :: copy"></div>
<div th:replace="footer :: copy"></div>
<div th:include="footer :: copy"></div>
<!--th:insert是在div中插入代碼塊,即多了一層div-->
<div>
<footer>
© 2011 The Good Thymes Virtual Grocery
</footer>
</div>
<!--th:replace是將代碼塊代替當前div,其html結構和之前一致-->
<footer>
© 2011 The Good Thymes Virtual Grocery
</footer>
<!--th:include是將代碼塊footer的內容插入到div中,即少了一層footer-->
<div>
© 2011 The Good Thymes Virtual Grocery
</div>
#{...} 消息表達式
消息表達式一般用於國際化的場景。結構:th:text="#{msg}"
。會在第三部分的實戰詳細介紹。
@{...} 鏈接表達式
鏈接表達式好處
不管是靜態資源的引用,form表單的請求,凡是鏈接都可以用@{...}
。這樣可以動態獲取項目路徑,即便項目名變了,依然可以正常訪問
#修改項目名,鏈接表達式會自動修改路徑,避免資源文件找不到
server.context-path=/itdragon
鏈接表達式結構
無參:@{/xxx}
有參:@{/xxx(k1=v1,k2=v2)}
對應url結構:xxx?k1=v1&k2=v2
引入本地資源:@{/項目本地的資源路徑}
引入外部資源:@{/webjars/資源在jar包中的路徑}
列舉:第三部分的實戰引用會詳細使用該表達式
<link th:href="@{/webjars/bootstrap/4.0.0/css/bootstrap.css}" rel="stylesheet">
<link th:href="@{/main/css/itdragon.css}" rel="stylesheet">
<form class="form-login" th:action="@{/user/login}" th:method="post" >
<a class="btn btn-sm" th:href="@{/login.html(l='zh_CN')}">中文</a>
<a class="btn btn-sm" th:href="@{/login.html(l='en_US')}">English</a>
${...}變量表達式
變量表達式有豐富的內置方法,使其更強大,更方便。
變量表達式功能
一、可以獲取對象的屬性和方法
二、可以使用ctx,vars,locale,request,response,session,servletContext內置對象
三、可以使用dates,numbers,strings,objects,arrays,lists,sets,maps等內置方法(重點介紹)
常用的內置對象
一、ctx :上下文對象。
二、vars :上下文變量。
三、locale:上下文的語言環境。
四、request:(僅在web上下文)的 HttpServletRequest 對象。
五、response:(僅在web上下文)的 HttpServletResponse 對象。
六、session:(僅在web上下文)的 HttpSession 對象。
七、servletContext:(僅在web上下文)的 ServletContext 對象
這里以常用的Session舉例,用戶刊登成功后,會把用戶信息放在Session中,Thymeleaf通過內置對象將值從session中獲取。
// java 代碼將用戶名放在session中
session.setAttribute("userinfo",username);
// Thymeleaf通過內置對象直接獲取
th:text="${session.userinfo}"
常用的內置方法
一、strings:字符串格式化方法,常用的Java方法它都有。比如:equals,equalsIgnoreCase,length,trim,toUpperCase,toLowerCase,indexOf,substring,replace,startsWith,endsWith,contains,containsIgnoreCase等
二、numbers:數值格式化方法,常用的方法有:formatDecimal等
三、bools:布爾方法,常用的方法有:isTrue,isFalse等
四、arrays:數組方法,常用的方法有:toArray,length,isEmpty,contains,containsAll等
五、lists,sets:集合方法,常用的方法有:toList,size,isEmpty,contains,containsAll,sort等
六、maps:對象方法,常用的方法有:size,isEmpty,containsKey,containsValue等
七、dates:日期方法,常用的方法有:format,year,month,hour,createNow等
文章底部提供了對應的官網鏈接
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<title>ITDragon Thymeleaf 內置方法</title>
</head>
<body>
<h2>ITDragon Thymeleaf 內置方法</h2>
<h3>#strings </h3>
<div th:if="${not #strings.isEmpty(itdragonStr)}" >
<p>Old Str : <span th:text="${itdragonStr}"/></p>
<p>toUpperCase : <span th:text="${#strings.toUpperCase(itdragonStr)}"/></p>
<p>toLowerCase : <span th:text="${#strings.toLowerCase(itdragonStr)}"/></p>
<p>equals : <span th:text="${#strings.equals(itdragonStr, 'itdragonblog')}"/></p>
<p>equalsIgnoreCase : <span th:text="${#strings.equalsIgnoreCase(itdragonStr, 'itdragonblog')}"/></p>
<p>indexOf : <span th:text="${#strings.indexOf(itdragonStr, 'r')}"/></p>
<p>substring : <span th:text="${#strings.substring(itdragonStr, 2, 8)}"/></p>
<p>replace : <span th:text="${#strings.replace(itdragonStr, 'it', 'IT')}"/></p>
<p>startsWith : <span th:text="${#strings.startsWith(itdragonStr, 'it')}"/></p>
<p>contains : <span th:text="${#strings.contains(itdragonStr, 'IT')}"/></p>
</div>
<h3>#numbers </h3>
<div>
<p>formatDecimal 整數部分隨意,小數點后保留兩位,四舍五入: <span th:text="${#numbers.formatDecimal(itdragonNum, 0, 2)}"/></p>
<p>formatDecimal 整數部分保留五位數,小數點后保留兩位,四舍五入: <span th:text="${#numbers.formatDecimal(itdragonNum, 5, 2)}"/></p>
</div>
<h3>#bools </h3>
<div th:if="${#bools.isTrue(itdragonBool)}">
<p th:text="${itdragonBool}"></p>
</div>
<h3>#arrays </h3>
<div th:if="${not #arrays.isEmpty(itdragonArray)}">
<p>length : <span th:text="${#arrays.length(itdragonArray)}"/></p>
<p>contains : <span th:text="${#arrays.contains(itdragonArray, 5)}"/></p>
<p>containsAll : <span th:text="${#arrays.containsAll(itdragonArray, itdragonArray)}"/></p>
</div>
<h3>#lists </h3>
<div th:if="${not #lists.isEmpty(itdragonList)}">
<p>size : <span th:text="${#lists.size(itdragonList)}"/></p>
<p>contains : <span th:text="${#lists.contains(itdragonList, 0)}"/></p>
<p>sort : <span th:text="${#lists.sort(itdragonList)}"/></p>
</div>
<h3>#maps </h3>
<div th:if="${not #maps.isEmpty(itdragonMap)}">
<p>size : <span th:text="${#maps.size(itdragonMap)}"/></p>
<p>containsKey : <span th:text="${#maps.containsKey(itdragonMap, 'thName')}"/></p>
<p>containsValue : <span th:text="${#maps.containsValue(itdragonMap, '#maps')}"/></p>
</div>
<h3>#dates </h3>
<div>
<p>format : <span th:text="${#dates.format(itdragonDate)}"/></p>
<p>custom format : <span th:text="${#dates.format(itdragonDate, 'yyyy-MM-dd HH:mm:ss')}"/></p>
<p>day : <span th:text="${#dates.day(itdragonDate)}"/></p>
<p>month : <span th:text="${#dates.month(itdragonDate)}"/></p>
<p>monthName : <span th:text="${#dates.monthName(itdragonDate)}"/></p>
<p>year : <span th:text="${#dates.year(itdragonDate)}"/></p>
<p>dayOfWeekName : <span th:text="${#dates.dayOfWeekName(itdragonDate)}"/></p>
<p>hour : <span th:text="${#dates.hour(itdragonDate)}"/></p>
<p>minute : <span th:text="${#dates.minute(itdragonDate)}"/></p>
<p>second : <span th:text="${#dates.second(itdragonDate)}"/></p>
<p>createNow : <span th:text="${#dates.createNow()}"/></p>
</div>
</body>
</html>
后台給負責給變量賦值,和跳轉頁面。
@RequestMapping("varexpressions")
public String varexpressions(ModelMap map) {
map.put("itdragonStr", "itdragonBlog");
map.put("itdragonBool", true);
map.put("itdragonArray", new Integer[]{1,2,3,4});
map.put("itdragonList", Arrays.asList(1,3,2,4,0));
Map itdragonMap = new HashMap();
itdragonMap.put("thName", "${#...}");
itdragonMap.put("desc", "變量表達式內置方法");
map.put("itdragonMap", itdragonMap);
map.put("itdragonDate", new Date());
map.put("itdragonNum", 888.888D);
return "grammar/varexpressions";
}
三、Thymeleaf在SpringBoot應用
Thymeleaf是Spring Boot 官方推薦使用的模版引擎,這也意味着用Thymeleaf比其他模版引擎更簡單。
開發步驟:
第一步:引入Thymeleaf依賴。
第二步: 提取公共頁面,提高代碼的重用性,統一頁面風格。
第三步:頁面顯示和國際化功能
引入Thymeleaf
pom.xml 引入Thymeleaf的依賴,並確定其版本
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<thymeleaf.version>3.0.9.RELEASE</thymeleaf.version>
<thymeleaf-layout-dialect.version>2.2.2</thymeleaf-layout-dialect.version>
</properties>
<dependencies>
<dependency> <!--引入模版引擎thymeleaf-->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
提取公共頁面
為了統一頁面風格,提高頁面的復用率,我們一般都會提取公共頁面。之前在文章中介紹了SiteMesh的使用,今天用Thymeleaf來實現。
統一規范引入的資源文件
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:fragment="common-head">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
<title>ITDragon系統</title>
<link type="image/x-icon" href="images/favicon.ico" rel="shortcut icon">
<link th:href="@{/sb-admin-1.0.4/css/bootstrap.min.css}" rel="stylesheet">
<link th:href="@{/sb-admin-1.0.4/css/sb-admin.css}" rel="stylesheet">
<link th:href="@{/sb-admin-1.0.4/css/plugins/morris.css}" rel="stylesheet">
<link th:href="@{/sb-admin-1.0.4/font-awesome/css/font-awesome.min.css}" rel="stylesheet">
<script th:src="@{/sb-admin-1.0.4/js/jquery.js}"></script>
<script th:src="@{/sb-admin-1.0.4/js/bootstrap.min.js}"></script>
<script th:src="@{/sb-admin-1.0.4/js/plugins/morris/raphael.min.js}"></script>
<script th:src="@{/sb-admin-1.0.4/js/plugins/morris/morris.min.js}"></script>
<script th:src="@{/sb-admin-1.0.4/js/plugins/morris/morris-data.js}"></script>
</head>
</html>
統一左側菜單欄
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
</head>
<body>
<header id="header" th:fragment="common-header">
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/dashboard">ITDragon sb-admin-1.0.4</a>
</div>
<!--和知識點沒關系的代碼,這里就補貼出來了,完整代碼請異步github-->
<!-- Sidebar Menu Items - These collapse to the responsive navigation menu on small screens -->
<div class="collapse navbar-collapse navbar-ex1-collapse">
<ul class="nav navbar-nav side-nav itdragon-nav">
<li th:class="${activeUrl=='dashboard'?'nav-link active':'nav-link'}">
<a th:href="@{/dashboard}"><i class="fa fa-fw fa-dashboard"></i> Dashboard</a>
</li>
<li th:class="${activeUrl=='employees'?'nav-link active':'nav-link'}">
<a th:href="@{/employees}"><i class="fa fa-fw fa-bar-chart-o"></i> Employees</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</nav>
</header>
</body>
</html>
以上代碼用到了三個知識點:
一、使用鏈接表達式引入本地的資源文件,若引入第三方外部資源文件,可以通過webjars(將資源文件打成jar包放在項目中)方式引入。
二、使用th:fragment標識需要被引用的代碼塊,也可以用id選擇器但不推薦。
三、activeUrl變量是通過代碼塊表達式在其他頁面傳入的變量,這也是代碼塊表達式強大的一個功能。
頁面顯示和國際化
Spring Boot 實現國際化步驟:
第一步:准備好國際化文件,至少三分(系統默認,中文,英文)
第二步:在Spring Boot全局配置文件中,指定國際化文件路徑,
第三步:自定義Locale Resolver
第四步:在頁面上使用消息表達式輸出國際化內容
這里只貼出第四步的代碼,前三步以及完整代碼請異步github
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head th:replace="~{commons/default::common-head}">
<meta name="viewport" content="initial-scale=1.0, width=device-width, user-scalable=no" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,Chrome=1" />
<meta http-equiv="X-UA-Compatible" content="IE=8" />
<title>員工列表</title>
</head>
<body>
<div id="wrapper">
<header th:replace="~{commons/header::common-header(activeUrl='employees')}"></header>
<div id="page-wrapper">
<div class="container-fluid">
<!-- Page Heading -->
<div class="row">
<div class="col-lg-12">
<h1 class="page-header" th:text="#{employees}"></h1>
<ol class="breadcrumb">
<li><i class="fa fa-dashboard"></i> <a th:href="@{/dashboard}" th:text="#{dashboard}"></a>
</li>
<li class="active"><i class="fa fa-table"></i> <span th:text="#{employees}"></span></li>
</ol>
</div>
</div>
<div class="row" th:if="${not #strings.isEmpty(message)}">
<div class="col-lg-12">
<div class="alert alert-info alert-dismissable">
<button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>
<i class="fa fa-info-circle"></i> <strong th:text="${message}"></strong>
</div>
</div>
</div>
<!-- /.row -->
<div class="row">
<div class="col-lg-12">
<h2 th:text="#{employees}"></h2>
<div class="table-responsive">
<a class="pull-right btn" th:href="@{/employee}" th:text="#{add.employees}"></a>
<table class="table table-striped table-sm">
<thead>
<tr>
<th th:text="#{id}"></th>
<th th:text="#{last.name}"></th>
<th th:text="#{email}"></th>
<th th:text="#{gender}"></th>
<th th:text="#{department}"></th>
<th th:text="#{position}"></th>
<th th:text="#{birth}"></th>
<th th:text="#{operation}"></th>
</tr>
</thead>
<tbody>
<tr th:each="emp:${employees}">
<td th:text="${emp.id}"></td>
<td>[[${emp.lastName}]]</td>
<td th:text="${emp.email}"></td>
<td th:text="${emp.gender}==0?#{female}:#{male}"></td>
<td th:text="${emp.department.departmentName}"></td>
<td th:text="${emp.department.position}"></td>
<td th:text="${#dates.format(emp.birth, 'yyyy-MM-dd HH:mm')}"></td>
<td>
<a class="btn btn-sm btn-success" th:href="@{/employee/}+${emp.id}" th:text="#{edit}"></a>
<a class="btn btn-sm btn-danger deleteBtn" th:href="@{/employee/}+${emp.id}" th:text="#{delete}"></a>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- /.row -->
</div>
</div>
</div>
</body>
</html>
以上代碼用到了知識點:
一、頁面通過代碼塊表達式引入公共代碼塊,並傳入參數給公共代碼塊文件。
二、頁面使用消息表達式輸出國際化內容。
三、使用th:if屬性條件判斷,使用內置方法#strings.isEmpty 判斷參數是否為空,使用內置方法#dates.format 格式化參數
四、使用th:each屬性循環遍歷,注意該屬性修改在tr標簽上。並使用th:text屬性給td標簽賦值
四、總結
一、Thymeleaf 是Spring Boot 官方推薦的Java模版引擎框架,其文件擴展名為.html
二、Thymeleaf 幾乎支持所有的html屬性,用於賦值的th:text和th:value,用於循環遍歷的th:each,用於條件判斷的th:if
三、Thymeleaf 提供四種標准的表達式,有豐富內置方法的${},用於國際化的#{},用於代碼插入的~{},用於處理鏈接的@{}
四、一定要注意循環遍歷的th:each和代碼插入的th:insert用法,盡量避免破壞html結構的細節問題
參考文獻:
https://www.thymeleaf.org/doc/tutorials/3.0/usingthymeleaf.html#appendix-a-expression-basic-objects
文章到這里就結束了。如果文章對你有幫助,可以點個"推薦",也可以"關注"我,獲得更多豐富的知識。
這里是博客文章目錄一欄表中的部分內容,如果有感興趣的內容可以點擊右邊的鏈接: http://www.cnblogs.com/itdragon/p/8709948.html