thymeleaf语法规则:

  • 作者: 凯哥Java(公众号:凯哥Java)
  • 工作小总结
  • 时间:2022-12-27 11:25
  • 2563人已阅读
简介 1)、th:text:改变当前元素里面的文本内容。语法文档:https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.pdfth:任意html属性:可以替换原生的HTML的元素。2)、表达式语法:行里表达式:[[xx]]—相当于th:text,[(xx)]—相当于th:utext● Simple expression

🔔🔔好消息!好消息!🔔🔔

 如果您需要注册ChatGPT,想要升级ChatGPT4。凯哥可以代注册ChatGPT账号代升级ChatGPT4

有需要的朋友👉:微信号 kaigejava2022

1)、th:text:改变当前元素里面的文本内容。语法文档:https://www.thymeleaf.org/doc/tutorials/3.0/thymeleafspring.pdf

th:任意html属性:可以替换原生的HTML的元素。

47ca44cc4878bc5c5fe5818d299c3316.png

2)、表达式语法:行里表达式:[[xx]]—相当于th:text , [(xx)]—相当于th:utext● Simple expressions:(表达式语法)

○ Variable Expressions: ${...}:获取变量值,底层时OGNL;

1)、获取对象的属性、调用方法;

2)、使用内置的基本对象;#location...

3)、内置的一些工具对象;#strings...

○ Selection Variable Expressions: *{...}:选择表达式,与${}的功能一样,有一个不同,可以参考文档。

○ Message Expressions: #{...}:用来获取国际化信息

○ Link URL Expressions: @{...}:用来定义URL连接

○ Fragment Expressions: ~{...}:片段引入表达式

● 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:

○ Page 17 of 106

● No-Operation: _:(特殊操作)


TopTop