Thymeleaf共通言葉遣い、例で、最も完全な!

Thymeleaf:
主流の市場、Javaのテンプレートエンジンがあります。JSP、速度、Freemarkerの、Thymeleaf
JSPテンプレートエンジンが本質である、春ブーツの関係者は「Thymeleaf」テンプレートエンジンをお勧めします

Thymeleaf公式サイト:https://www.thymeleaf.org/
ThymeleafのGithubで家:https://github.com/thymeleaf/thymeleaf
Thymeleafリファレンスマニュアル:https://blog.csdn.net/zrk1000/article/details/ 72667478 /

1.th

<a th:href="@{/admin/examination/paper/initAdd}"></a>

目:HREF @ {}:リンク

<a th:href="@{/web/uc/order/orderInfo?orderId={orderId}(orderId=${order['id']})}" class="c-999">详情</a>

目:HREF @ {}:パラメータ

<script type="text/javascript" 	th:src="@{{path}/admin/libs/plugins/layer/laydate/laydate.js?v={v}(path=${staticPath},v=${v})}">
</script>
<script type="text/javascript" th:src="@{/course/cou/select-common-course.js?v={v}(v=${v})}">
</script>     

目:SRC @ {}:導入JS、CSSの写真など

<script th:inline="javascript"> </script>

目:インライン= "javascriptの":書き込みJSを使用してページ(スクリプトをインライン)
TH:インライン= "テキスト":(テキストインライン)

<input hidden id="id" name="id" th:value="${examPaper['id']}" 	th:placeholder="XXX" />

目:値:値の値
番目:プレースホルダ:説明

<span th:if="${useType}==1" class="fs14 c-999">试卷</span>

目:もし:分析

<input name="stick" type="radio" value="2" 	th:checked="${examPaper['stick']} == 2" /> <strong>是</strong>

目:確認:確認选中

<span class="fs24 c-master" th:text="${statistics['count']}"></span>

目:テキスト:テキスト、通常の文字列

<textarea th:disabled="${personalTask['marked']}==2?  'true':'false'"
	th:attr="data-record=${personalTask['questionRecordMap'][question.id+'']['id']}" class=""
	th:utext="${personalTask['questionRecordMap'][question.id+'']['comment']}">
</textarea>

目:ATTR:属性
番目:UTEX:エスケープ文字

<tr th:if="!${#lists.isEmpty(examPaper['classesList'])}" 
	th:each="classes,index : ${examPaper['classesList']}" 	th:attr="data-classes=${classes['id']}">
	<td class="text-center" th:text="${classes['id']}"></td>
</tr>

目:各:サイクリング
index.index:添字
index.count:ナンバー

<li th:if="${paper['status']} == 0" th:attrprepend="data-id=${paper['id']}" class="publish"></li>

attrprepend:目のattr +スプライシングプロパティ

<li data-type="VIDEO" th:classappend="${courseTypeKey}=='VIDEO'?'active':''"  class="cm-filter-item">录播课</li>

目:classappend:クラス+スプライシングプロパティ

<img class="wm-img" th:src="${details['shop']['book']['imageMap']['mobileUrlMap']['large']}" th:alt="${details['shop']['book']['bookName']}"/>

目:SRC:画像パスの導入
番目:ALT:altテキスト表示

2.map

<select th:disabled="${examPaper['status']} != 0 or !${#maps.isEmpty(classes)}" class="form-control" id="select">
</select>

目:xxは表示されません条件:無効

$ {#Maps.isEmpty()}マップは空であります

!$ {#Maps.isEmpty()}:マップは空ではありません

3.list

<tr th:class="${#lists.isEmpty(examPaper['courseList'])} ? '':'hide'"></tr>
<span th:if="!${#lists.isEmpty(course['teacherList'])} and ${#lists.size(course['teacherList'])}>4" ></span>

目:クラスのクラススタイル

$ {#Lists.isEmpty()}リストが空であります

!$ {#Lists.isEmpty()}リストは空ではありません

$ {#lists.size()}リスト长度

4.string

<section th:if="${#strings.isEmpty(course['details'])}"class="no-data__wrap">
</section>

<span class="fs18" th:text="${#strings.concat('班级名称:', classes['name'])}"></span>

<samp th:text="${#strings.substring(details['createTime'],0,16)}"></samp>

$ {#Strings.isEmpty()}文字列が空であります

$ {#Strings.concat( ''、 '')スプライス

$ {#Strings.contains()}を含む文字

$ {#Strings.substring( '' ,,)文字列の傍受

5.date

<div class="pull-right">&copy;<span th:text="'2010-'+${#dates.format(new java.util.Date().getTime(), 'yyyy')}"></span></div>

$ {#Dates.format( ''、 '')}フォーマットされた日付

<span th:text="${#dates.format(taskExamPaperEndTime, 'yyyy-MM-dd HH:mm:ss')}"></span>

日付の形式は次のとおりです。YYYY-MM-DD HH:mm:ssの形式

6.number

<li th:each="ye : ${#numbers.sequence(2016,year)}" th:attrappend="data-year=${ye}" th:text="${ye}" class="cm-filter-item"></li>

$ {#Numbers.sequence()}時刻含みます

<span th:text="${#numbers.formatDecimal(viewParsMap['entity']['userId'],1,0)}"></span>

#Numbers.formatDecimal():小数点の小数点以下取り出さ転送int型はuserId、。

<td class="text-center" th:text="${#numbers.formatDecimal(record['examTime']/60,1,0,'POINT')}+'分'+${record['examTime']}%60 +'秒'"></td>

秒への第二のフォーマット分+

その他7.

<div data-th-replace="common/functionDepict"></div>

追加のテンプレートを導入し、データ番目-置き換えます

<th:block th:if="${useType}==2 and ${#maps.isEmpty(classes)}"></th:block>

<TH:ブロック> <番目/:ブロック> XXX表示条件

<input type="hidden" th:attr="id='questionCount_'+${personalTask['id']}" th:value="${personalTask['questionCount']}"/>

ダイナミックID

th:data-id="${examQuestionRecord['id']}+'-'+${subIndex.count}"

唯一の動的ID

th:attr="data-id=${personalTask['examPaper']['id']},data-time=${#strings.substring(personalTask['examPaper']['endTime'],0,16)},data-url=${personalTask['examPaper']['datumList'][0]['url']}"

目:ATTR「」属性は、複数のデータ - を定義することができます

${#strings.replace(#strings.substring(dataMap['openTime'],5,16),'-','月')}

フォーマットYYYY-MM-DD HH:MM:XXにSS、HHをxxを:MMは

公開された114元の記事 ウォン称賛52 ビュー20000 +

おすすめ

転載: blog.csdn.net/Smile_Sunny521/article/details/97670759