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. AndroidProjects个人项目归纳

    AndroidProjects 个人总结归纳-目录大纲 Data Binding框架MVVM BaseView CollapseView 更新中... 项目地址:https://github.com/ ...

  2. 在项目中使用ExtJS

    主要目录文件介绍 builds:压缩后的ExtJS代码,体积更小,更快:docs:开发文档:examples:官方演示示例:locale:多国语言资源文件:pkgs:ExtJS各部分功能的打包文件:r ...

  3. nrm NPM源管理工具

    nrm NPM源管理工具 工具 前端 npm cnpm 今天经过同事介绍,发现一个好玩的东西——nrm(NPM registry manager) nrm 是一个可以快速切换NPM源的node插件.由 ...

  4. 转载文章(Redis中对key的操作)

    转载地址:http://www.cnblogs.com/stephen-liu74/archive/2012/03/26/2356951.html 一.概述: 在该系列的前几篇博客中,主要讲述的是与R ...

  5. 关于WCF测试时出现无法从***获取元数据问题

    在我们已经创建成功一个WCF服务后,通过本机localhost访问和测试均没有任何问题.但是寄宿在IIS/其他平台下时便会出现以下的错误信息 1.使用WCF Test Client错误 2.通过C#引 ...

  6. solr定时更新索引遇到的问题(SolrDataImportProperties Error loading DataImportScheduler properties java.lang.NullPointerException)

    问题描述 报如下错误,很显然,问题原因:空指针异常: ERROR (localhost-startStop-1) [   ] o.a.s.h.d.s.SolrDataImportProperties ...

  7. 从MySQL 5.5迁移到Mariadb 10.1.14

    从MySQL 5.5迁移到Mariadb 10.1.14 迁移计划如下: 1.备份MySQL 5.5的数据库,对指定库进行备份. 2.还原到Mariadb,然后建立复制. 3.然后就可以愿意啥时候切换 ...

  8. yii2 增删改查

    自己总结的yii2 advanced 版本的简单的增删改查,希望对大家有所帮助 1.gii生成的actionCreate()方法中 获取插入语句的id $id = $model->attribu ...

  9. easyUI的基础布局easyui-accordion

    ---恢复内容开始--- <html> <head> <meta charset="UTF-8"> <title>树状图</t ...

  10. 在Ubuntu Server 14.04中搭建FTP服务器(VMWare)

    自己搭建ftp服务器,方便主机与虚拟机中的Ubuntu传输文件. 选用的ftp软件为vsftpd. 1.命令行: sudo apt-get install vsftpd 2.安装完配置: vsftpd ...