当前位置:首页 > 技术交流 > 学习笔记 > 正文内容

thymeleaf笔记

薇薇3年前 (2020-12-14)学习笔记1421

基础语法

文本标签 th:text/th:utext

· 字符串拼接

· *{...}${...}表达式

· #{...}表达式

· ~{...}片段表达式

· @{...}链接网址表达式

· 条件判断 th:if/th:unless

· switch

· for循环

· th:href

· th:class

· th:attr

· th:value

· th:action

· th:id

· th:inline

· th:onclick

· th:selected

· th:src

· th:style

· th:with

· Elvis运算符

· 三元表达式

· No-Operation_)什么都不做

· 内联

· 如何使用内连操作

· 禁用内联操作

· JavaScript内联

· CSS内联

· 模板布局

· 定义引用片段代码

· 通过id属性来声明片段

· th:insertth:replace(和th:include)之间的区别

· 带参数的引用片段

· 删除模版片段

· 预定义的工具对象

· #dates

· #numbers

· #strings

· #bools

· #arrays

· #lists

· #sets

· #maps

· #aggregates

 

 

 

引入语法<html xmlns:th="http://www.thymeleaf.org">

<!-- thymeleaf 相关依赖 -->

Springboot配置pom.xml  

<dependency>

  <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-starter-thymeleaf</artifactId>

</dependency>

 

application.peoperties添加thymeleaf配置

server.port=8090

server.servlet.context-path=/sbe

 

#关闭 Thymeleaf 的缓存开发过程中无需重启

spring.thymeleaf.cache = false

#设置thymeleaf页面的编码

spring.thymeleaf.encoding=UTF-8

spring.thymeleaf.mode=HTML5

#设置thymeleaf页面的后缀

spring.thymeleaf.suffix=.html

#设置thymeleaf页面的存储路径

spring.thymeleaf.prefix=classpath:/templates/

 

 

 

#控制器中的Model引包引得是 :import org.springframework.ui.Model;

 

 

 

th:onclick=|da(xxx,${xxx})| 动态给方法赋参数

 

 

 

 

 

 

 

 

 

 

 

 

 


版权声明:本文由纵横四海博客发布,如需转载请注明出处。

部分资源整理自互联网,如侵权请联系站长删除!

本文链接:https://www.fxkgg.com/post/14.html

分享给朋友:

相关文章

Layui数据表格导出身份证时后三位变为E+/000的解决办法(templet一句话搞定)

Layui数据表格导出身份证时后三位变为E+/000的解决办法(templet一句话搞定)

在使用layui自带的数据表格导出功能时,身份证后三位显示为000,导致数据表无法使用的情况,如下图:其实要解决的话,非常简单,万不可参照网上那种千篇一律的文章,即所谓的插件包,比如这样:https:...

发表评论

访客

◎欢迎参与讨论,请在这里发表您的看法和观点。