1、在html顶部添加

<html xmlns:th="http://www.thymeleaf.org">

2、url表达式 @{...}

<link rel="stylesheet" type="text/css" href="../../static/css/order.css" th:href="@{/static/css/order.css}"/>
<script th:src="@{/webjars/jquery/2.1.4/jquery.min.js}" type="text/javascript" charset="utf-8"></script>

3、载入页面共同部分

<div class="head" th:include="include/head::head"></div>

  以下为共同部分:

<div class="head" th:fragment="head" xmlns:th="http://www.thymeleag.org">

</div>

4、th:value="${}"

//日期格式化#dates.format()
<input type="text" readonly="readonly" name="startTime" th:value="${startTime ne null ? #dates.format(startTime,'yyyy-MM-dd HH:mm:ss'):''}">

5、th:text="${}",数据转换

//价格转换
<span th:text="${#numbers.formatDecimal(price,1,2)}">120.00</span>
//日期格式
<span th:text="${#dates.format(date,'yyyy-MM-dd')}">2016-01-01</span>

6、th:class 定义样式

7、th:selected 下拉框选中

<option value="" th:selected="${status==1}">待付款</option>

8、th:each="orders : ${orders}" 遍历

9、th:if

<div th:if="${saleOrderMaps eq null or saleOrderMaps.size() eq 0}"></div>

10、th:switch="${items}"

  th:case="1"

11、th:attr="result=${}"

  

Thymeleaf的更多相关文章

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

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

  2. Thymeleaf 模板的使用

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

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

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

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

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

  5. Thymeleaf 与 Javascript

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

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

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

  7. Thymeleaf+Spring整合

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

  8. thymeleaf常用标签

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

  9. thymeleaf的常见用法

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

随机推荐

  1. Unable to simultaneously satisfy constraints.

    在进行版本的迭代更新时,新功能需求需要对主页面的UI进行重新的布局,但是,报了错误,出了好多约束方面的问题: Unable to simultaneously satisfy constraints. ...

  2. mac,/usr/local is not writable 解决方法

    mac,/usr/local is not writable 解决方法 mac 问题 今天在mac上装mongodb,发现提示权限不足问题,错误提示如下: mac安装mongodb错误提示.jpg 尝 ...

  3. 利用sphinx为python项目生成API文档

    sphinx可以根据python的注释生成可以查找的api文档,简单记录了下步骤 1:安装 pip install -U Sphinx 2:在需要生成文档的.py文件目录下执行sphinx-apido ...

  4. Atitit. 项目文档目录大纲 总集合  v2

    Atitit. 项目文档目录大纲 总集合  v2 -----Atitti.原有项目源码的架构,框架,配置与环境说明 v3 q511 -----Atitit.开发环境 与 工具 以及技术框架 以及 注意 ...

  5. ASP.NET MVC 5 04 - 控制器

    PS: 唉.本来这一篇前几天早就应该发了的,可是谁每月没有那么几天啊... 呵呵.开个玩笑.反正就是各种烦气,所以也就一直没上来继续发了. 年底了,摆正一下心态吧.好好干,整点钱,过年回家能跟亲朋好友 ...

  6. redis-cli中那些或许我们还不知道的一些实用小功能

    玩过redis的朋友都知道,redis中有一个叫做redis-cli的小工具,我们可以利用它在test和develop环境下进行高效的模拟测试,然而在现实环境中, 我们只知道直接键入redis-cli ...

  7. JavaScript & PHP模仿C#中string.format效果

    1.JavaScript function stringformat() { var args = Array.prototype.slice.call(arguments); if (args.le ...

  8. 0040 Java学习笔记-多线程-线程run()方法中的异常

    run()与异常 不管是Threade还是Runnable的run()方法都没有定义抛出异常,也就是说一条线程内部发生的checked异常,必须也只能在内部用try-catch处理掉,不能往外抛,因为 ...

  9. 【Linux】虚拟机安装Archlinux

    参考:https://wiki.archlinux.org/index.php/Installation_guide_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87) 安装 ...

  10. .net framework体系结构

    CIL(common intermediate language):公共中间语言..net框架下各种种类.版本的编程语言在经过编译后生成的中间语言(后缀为.il),与平台无关.与语言无关,只要机器上运 ...