博主
258
258
258
258
专辑

第四节 Thymeleaf模版指令:条件语句

亮子 2022-02-14 12:59:10 6339 0 0 0

th:if条件判断除了判断boolean值外,Thymeleaf 还认为如下表达式为true:

• 值非空
• 值是非0数字
• 值是字符串,但是不是false, off or no
• 值不是boolean值,数字,character或字符串

Strings逻辑判断

isEmpty
contains

  • 检查字符串变量是否包含片段
${#strings.contains(name,'abc')}
  • strings判断语法的其他几个常用方法
  • strings的字符串操作函数

除了字符串判断语句外,#strings 还支持字符串的数据处理,比如