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. TextField和TextView的限制输入长度

    TextField的限制代理方法 只需要在这个代理方法里面code这样的代码就可以了 16 是长度可以自己设置 - (BOOL)textField:(UITextField *)textField s ...

  2. Hadoop技巧(02):时间同步

    阅读目录 序 时间同步 系列索引 本文版权归mephisto和博客园共有,欢迎转载,但须保留此段声明,并给出原文链接,谢谢合作. 文章是哥(mephisto)写的,SourceLink 序 在实际部署 ...

  3. XSS 防御方法总结

    1. XSS攻击原理 XSS原称为CSS(Cross-Site Scripting),因为和层叠样式表(Cascading Style Sheets)重名,所以改称为XSS(X一般有未知的含义,还有扩 ...

  4. MySQL学习笔记

    数据库 P3306create database [if not exists] db_name [characterset gbk];use database;//跳转数据库show databas ...

  5. laravel框架中容器类简化代码-摘自某书

    <?php //容器类装实例或提供实例的回调函数 class Container { protected $bindings = []; //绑定接口和生成相应实例的回调函数 public fu ...

  6. PB gird类型数据窗口 设置分组、分组小计、合计

    今天遇到一个需求,gird表格数据如下:  部门  类型 数据   A  类型1  1  A  类型2  2  B  类型1  3  B  类型2  4   合计 10 实际需要显示的结果为:  部门 ...

  7. Swift和Objective-C混编注意事项

    前言 Swift已推出数年,与Objective-C相比Swift的语言机制及使用简易程度上更接地气,大大降低了iOS入门门槛.当然这对新入行的童鞋没来讲,的确算是福音,但对于整个iOS编程从业者来讲 ...

  8. idea fect

    idea facet 昨天从svn检查一个项目后,部署至tomcat服务器,启动成功,但实际代码其实没有进去, 因为该项目不是maven项目, artifacats是自己配的, 应该是这里弄错的. 最 ...

  9. 理解HTML语义化

    1.什么是HTML语义化? <基本上都是围绕着几个主要的标签,像标题(H1~H6).列表(li).强调(strong em)等等> 根据内容的结构化(内容语义化),选择合适的标签(代码语义 ...

  10. mysql max_allowed_packet 设置过小导致记录写入失败

    mysql根据配置文件会限制server接受的数据包大小. 有时候大的插入和更新会受max_allowed_packet 参数限制,导致写入或者更新失败. 查看目前配置 show VARIABLES ...