Thymeleaf运算符怎么用
这篇文章主要介绍“Thymeleaf运算符怎么用”的相关知识,小编通过实际案例向大家展示操作过程,操作方法简单快捷,实用性强,希望这篇“Thymeleaf运算符怎么用”文章能帮助大家解决问题。
成都创新互联公司-专业网站定制、快速模板网站建设、高性价比南票网站开发、企业建站全套包干低至880元,成熟完善的模板库,直接使用。一站式南票网站制作公司更省心,省钱,快速模板网站建设找我们,业务覆盖南票地区。费用合理售后完善,10年实体公司更值得信赖。
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
package com.example.demo; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; @Controller public class TestController { @RequestMapping("/") public String test(Model model){ model.addAttribute("flag", true); return "test"; } }
3、src/main/resources/templates/test.html
一、表达式常量
1、字符串常量:使用单引号,或|