日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

Thymeleaf语法变量

發布時間:2025/3/20 编程问答 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 Thymeleaf语法变量 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

字面量

包括字符串、數字、布爾值、null、多個數據格式

Literals(字面量)
Text literals: ‘one text’ , ‘Another one!’ ,…
Number literals: 0 , 34 , 3.0 , 12.3 ,…
Boolean literals: true , false
Null literal: null
Literal tokens: one , sometext , main ,…

字符串操作

包括字符串拼接、字符串替換

Text operations:(文本操作)
String concatenation: +
Literal substitutions: |The name is ${name}|

數學運行

包括基本運算

Arithmetic operations:(數學運算)
Binary operators: + , ‐ , * , / , %
Minus sign (unary operator): ‐

布爾運算

包括并、或、非

Boolean operations:(布爾運算)
Binary operators: and , or
Boolean negation (unary operator): ! , not

比較運算

包括常用比較運算符

Comparisons and equality:(比較運算)
Comparators: > , < , >= , <= ( gt , lt , ge , le )
Equality operators: == , != ( eq , ne )

條件運算

包括常用條件表達式,支持三元運算符

Conditional operators:(條件運算)
If‐then: (if) ? (then)
If‐then‐else: (if) ? (then) : (else)
Default: (value) ?: (defaultvalue)

特殊操作

_,表示不進行任何操作

Special tokens:(特殊操作)
No‐Operation: _

<!DOCTYPE html> <html lang="en" xmlns:th="http://www.thymeleaf.org"> <head><meta charset="UTF-8"><title>Title</title> </head> <body> <h1>成功!</h1> <!--th:text 將div里面的文本內容設置為 --> <div id="div01" class="myDiv" th:id="${hello}" th:class="${hello}" th:text="${hello}">這是顯示歡迎信息</div> <hr/> <div th:text="${hello}"></div> <div th:utext="${hello}"></div> <hr/><!-- th:each每次遍歷都會生成當前這個標簽: 3個h4 --> <h4 th:text="${user}" th:each="user:${users}"></h4> <hr/> <h4><span th:each="user:${users}"> [[${user}]] </span> </h4> <form th:action="@{/upload}" method="post" enctype="multipart/form-data"><input type="file" name="file"><input type="submit"/> </form></body> </html> 《新程序員》:云原生和全面數字化實踐50位技術專家共同創作,文字、視頻、音頻交互閱讀

總結

以上是生活随笔為你收集整理的Thymeleaf语法变量的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。