thymeleaf 基本功能是将 th:xxx的内容替换html标签的内容

原标签的内容会被替换掉,原内容只是前端用来显示demo的

和freemarker, velocity的重要区别是,它们的自定义内容是在html标签内, 而th是在html标签的属性上

th:if th:unless条件成立时,标签内容才会显示

js中使用thymeleaf,  需要使用th:inline

<script th:inline="javascript">
/*<![CDATA[*/
var __config__ = {
'userName': [[${user?.xxName}]]
}
/*]]>*/
</script>

为防止后端NPE, 对象后面加问号 ${xxx?.xxxAttr}

调用工具类的静态方法:?

内置变量:?

参考:

https://spring.io/guides/gs/serving-web-content/

https://www.tianmaying.com/tutorial/using-thymeleaf

foreach的使用 https://www.cnblogs.com/ityouknow/p/5833560.html

thymeleaf总结的更多相关文章

  1. spring boot(四):thymeleaf使用详解

    在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thymeleaf的使用.thymeleaf 是新一代的模板引擎,在spring4. ...

  2. Thymeleaf

    1.在html顶部添加 <html xmlns:th="http://www.thymeleaf.org"> 2.url表达式 @{...} <link rel= ...

  3. Thymeleaf 模板的使用

    Thymeleaf是现代化服务器端的Java模板引擎,不同与JSP和FreeMarker,Thymeleaf的语法更加接近HTML,并且也有不错的扩展性.详细资料可以浏览官网.本文主要介绍Thymel ...

  4. vert.x学习(三),Web开发之Thymeleaf模板的使用

    在vert.x中使用Thymeleaf模板,需要引入vertx-web-templ-thymeleaf依赖.pom.xml文件如下 <?xml version="1.0" e ...

  5. 页面上使用 Thymeleaf 的内联js不当造成了 java.lang.StackOverflowError: null 问题

    由于在页面上内联js使用不当,从而在从 Controller 跳转到页面时发生了以下错误: java.lang.StackOverflowError: null at org.thymeleaf.ut ...

  6. Thymeleaf 与 Javascript

    在 javascript 代码中使用 Thymeleaf 模板引擎: <script th:inline="javascript"> $("#content& ...

  7. Thymeleaf+SpringMVC,如何从模板中获取数据

    Thymeleaf+SpringMVC,如何从模板中获取数据 在一个典型的SpringMVC应用中,带@Controller注解的类负责准备数据模型Map的数据和选择一个视图进行渲染.这个模型Map对 ...

  8. Thymeleaf+Spring整合

    前言 这个教程介绍了Thymeleaf与Spring框架的集成,特别是SpringMvc框架. 注意Thymeleaf支持同Spring框架的3.和4.版本的集成,但是这两个版本的支持是封装在thym ...

  9. thymeleaf常用标签

    1. th:checked ,th:selected标签<input type="radio" value="M" name="gender&q ...

  10. thymeleaf的常见用法

    1,th:属性名="",就可以直接修改控件的属性,比如 <input th:type="button" th:name="xinxin" ...

随机推荐

  1. [转]PHP部分常见算法

    1. 用户密码六位数,不能大于六位而不能小于六数,数字值正则为[0-9],请用PHP写出有几种可能性,并做暴力破解; function dePassword($pwd) { $tmp = array( ...

  2. Java3D-对象基本变换

    一个球体与三个圆柱体形成一个组合体,在该组合体中,球体的透明度属性是由全透明到不透明之间变换,而且包括:旋转.平移等变换. package com.vfsd.test0621; import java ...

  3. wpf textblock超出显示范围后显示tooltip

    public static class TextTrmmingShowToolTip { public static readonly DependencyProperty IsToolTipProp ...

  4. GCD 学习(二)dispatch_queue_create创建Dispatch Queue

    摘录于: http://zhuyanfeng.com/archives/3042 dispatch_queue_create 用于创建用户线程队列.可以创建Serial/Concurrent Disp ...

  5. vue 之 指令系统介绍

    浏览目录 条件渲染 class 与style绑定 事件处理 指令系统介绍 所谓指令系统,大家可以联想咱们的cmd命令行工具,只要我输入一条正确的指令,系统就开始干活了. 在vue中,指令系统,设置一些 ...

  6. 重构get请求代码---PartyLocation

    将原理在PersonDto中定义的partyLocations,剪切到PartyDto中去. @JsonApiToMany private List<PartyLocationDto> p ...

  7. 数据结构_stack

    问题描述 一天,小 L 发现了一台支持一下操作的机器:IN x:将整数 x 入栈POP:将栈顶元素出栈ASUB:出栈两个数,将两数差的绝对值入栈COPY:将栈顶元素(如果有的话)复制一份,入栈现在小 ...

  8. 【转】深入理解java的String

    要理解 java中String的运作方式,必须明确一点:String是一个非可变类(immutable).什么是非可变类呢?简单说来,非可变类的实例是不能被修改的,每个实例中包含的信息都必须在该实例创 ...

  9. sql去掉换行符

    select replace(replace(ServiceCall,CHAR(13),''),CHAR(10),'') from outbound_complaint  where  bz1='朱成 ...

  10. .NET 实体转换辅助类

    /// <summary> /// 实体转换辅助类 /// </summary> public class ModelConvertHelper<T> where ...