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. HTML---用记事本写html

    <DOCTYPE HTML> <--DOCTYPE 文档类型,浏览器按照该类型解析--> <html> <head> <title>这个是h ...

  2. ZooKeeper:数据模型

    ZooKeeper数据模型 ZNode ZNode 分类 Stat Watcher Watcher工作原理 Watcher事件说明 Watcher注册 事件发布 示例 ZooKeeper 数据模型 整 ...

  3. Centos7安装完毕后无法联网的解决方法

    /etc/sysconfig/network-scripts/ 用ls命令查看网卡配置文件名(在CENTOS7中网卡名貌似变成了随机数字,所以每台机器的网卡名并不相同)

  4. ubuntu kylin 14.04安装配置redis-2.8.9(转)

    1.下载安装文件加压.编译和安装 cd /tmpwget http://download.redis.io/releases/redis-2.8.9.tar.gztar -zxf redis-2.8. ...

  5. python教程与资料

    网上有个人写的python快速教程,非常好.比看书好多了.猛击下面的链接地址 http://www.douban.com/group/topic/30008503/ python文档资料收集 pyth ...

  6. “会”和 "好”纯粹是两个概念

    你会吗? 如果我现在问下大家你会OOP 吗?你会OOD吗? 你知道SOLID吗?你会在实际工作中运用这些原则吗? 你知道模式吗,你会在实际项目中适时引入合理的设计模式来解决项目中的代码坏味吗? 你知道 ...

  7. 大数据慎行,数据管理要落实到KPI

    近年来,"大数据"一词被IT和互联网行业广泛提及,但真正落到实处的案例没有多少,大数据量支撑.数据挖掘技术.非结构化数据是阻碍的主要原因.大多数企业的信息化并没有达到到成熟水平,关 ...

  8. CentOS 配置MySQL允许远程登录

    Mysql为了安全性,在默认情况下用户只允许在本地登录,可是在有此情况下,还是需要使用用户进行远程连接,因此为了使其可以远程需要进行如下操作: 一.允许root用户在任何地方进行远程登录,并具有所有库 ...

  9. 移动端web开发,click touch tap区别

    转自: http://blog.csdn.net/sly94/article/details/51701188 移动端用tap时会有穿透问题 一:click与tap比较 click与tap都会触发点击 ...

  10. 用 ElementTree 在 Python 中解析 XML

    用 ElementTree 在 Python 中解析 XML 原文: http://eli.thegreenplace.net/2012/03/15/processing-xml-in-python- ...