概述
Thymeleaf表达式语法之常量分为字符串常量、数字常量、布尔值常量、空值常量;
运算符分为算术运算符、关系运算符、条件运算符、无操作符。
开发环境:IntelliJ IDEA 2019.2.2
Spring Boot版本:2.1.8
新建一个名称为demo的Spring Boot项目。
1、pom.xml
加入Thymeleaf依赖
org.springframework.boot
spring-boot-starter-thymeleaf
2、src/main/java/com/example/demo/TestController.java
packagecom.example.demo;importorg.springframework.stereotype.Controller;importorg.springframework.ui.Model;importorg.springframework.web.bind.annotation.RequestMapping;
@Controllerpublic classTestController {
@RequestMapping("/")publicString test(Model model){
model.addAttribute("flag", true);return "test";
}
}
3、src/main/resources/templates/test.html
一、表达式常量
1、字符串常量:使用单引号,或|最后
以上就是糟糕斑马为你收集整理的thymeleaf 常量_Thymeleaf常用语法:表达式语法之运算符的全部内容,希望文章能够帮你解决thymeleaf 常量_Thymeleaf常用语法:表达式语法之运算符所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复