1. th:checked ,th:selected标签
<input type="radio" value="M" name="gender" th:checked="${data.gender}=='M'"/>男
<input type="radio" value="F" name="gender" th:checked="${data.gender}=='F'"/>女
<option th:selected="${cookie[draftStatus]}?${cookie[draftStatus].getValue()}=='WSH':false">未审核</option>

2. 日期格式化,字符串截取
<span th:text="${#calendars.format(customerInfoVO.gmtCreated,'yyyy-MM-dd HH mm')}"></span>
<span th:text="${#strings.substring(entity.contactTime,0,10)}"></span>
tempo 写法 <span>{{gmtCreate | date 'YYYY-MM-DD HH:mm'}} </span>

3. a 标签带参数
<a th:if="(${entity.draftStatus}=='审核不通过') or (${entity.draftStatus}=='已发布') " class="btn btn-info" th:href="@{getItemById?(id=${entity.id},draftStatus=${entity.draftStatus}) }">编辑</a>
th:href="@{/index/bannerList}" 加‘/’ url 取相对路径 (http://localhost:8081/bauna)

4.th:attr
th:attr="itemId='DQR'+${entity.id},'src'=${entity.itemImg}"

5.列表序号 从1开始
<th:block th:each="entity,itemStat : ${contactNotes.getContactNotes()}">
<tr class="alignCenter entryOrderRow">
<td th:text="${itemStat.count+((page.curPage-1)*page.pageSize)}"></td>
<td th:text="${#calendars.format(entity.gmtCreate,'yyyy-MM-dd')}"></td>
</tr>
</th:block>

6.判断条件 表达式
<span th:if="1==1"></span> thymeleaf
{% if changeAmountTimes == 0 %} tempo模板
1111
{% else %}
22222
{% endif %}

7. 三元表达式
<td th:text="${entity.contactTimeNext!=null?(#strings.substring(entity.contactTimeNext,0,10)):' '}"></td>

8.tempo 渲染
<tr data-template-for="userRoleOrgList">
<td colspan="2">部门:<span>{{orgName}}</span></td>
<td colspan="10">角色:<span>{{roleDescription}}</span></td>
</tr>
userRoleOrgList为user 对象属性时 循环userRoleOrgList

9.字符串处理
${#strings.length(entity.content)} 获取字符串长度
${#strings.substring(entity.content,0,20)} 截取

10.页面数据供js 调用
<script th:inline="javascript">
/*<![CDATA[*/
var goodsList = [[${goodsList}]];
/*]]>*/
</script>

11.th:class, th:classappend, th:colspan
<tr th:classappend="(${entity.isContact}=='Y')?a:b" class="row-body alignCenter">
如果${entity.isContact}=='Y' tr 采用样式a , 否则 用样式 b
<td th:colspan="${orderEntity.invoiceStatus}!=null?2:3"></td>

12.转义标签 th:utext
<span style="color:#41a1d2;" >2016-06-17 16:43</span>
tempo 转义 :Tempo.prepare('orderTempo',{'escape': false})

13.工具类
日期处理 ${#dates.format(date,'dd/MMM/yyyy HH:mm')}
${#calendars.format(cal,'dd/MMM/yyyy HH:mm')}
数字 ${#numbers.formatInteger(1000000,3,'COMMA')}
字符串 ${#strings.contains(name,'EZ')}
$(#strings.substring(name,3,5))
集合 ${#arrays.length(array)}
${#lists.size(list)}

thymeleaf常用标签的更多相关文章

  1. thymeleaf 常用标签

    1.th:field th:field="*{user.sex}" 此标签会自动填充数据,比如用户的性别 user.sex 如果不为空,则会自动勾选上  2.th:each=&qu ...

  2. 4.Thymeleaf的常用标签

    一.常用标签 二.foreach案例 1.创建项目 2. 创建Student.java package cn.kgc.pojo; /** * Created by Administrator on 2 ...

  3. SpringBoot入门系列(五)Thymeleaf的常用标签和用法

    前面介绍了Spring Boot 中的整合Thymeleaf .不清楚的朋友可以看看之前的文章:https://www.cnblogs.com/zhangweizhong/category/16577 ...

  4. HTML常用标签

    HTML常用标签: HTML文档格式: 首先,HTML是一种超文本标签语言,它是制作网页的基础. 其次,HTML文档中至少包含基本的和成对的<html> </html>.< ...

  5. html常用标签介绍

    常用标签介绍 文本 最常用的标签可能是<font>了,它用于改变字体,字号,文字颜色. 点击查看效果 <font size="6">6</font&g ...

  6. HTML常用标签总结

    HTML 的常用标签总结 <font size="字体大小1-7" color="red或0xff00ff" face="字体类型(楷体等)&q ...

  7. html新增一些常用标签

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  8. [刘阳Java]_MyBatis_映射文件的常用标签总结_第5讲

    MyBatis中常用标签的总结,简单给出自己的总结 MyBatis映射文件中的标签使用介绍1.<select>:用于编写查询语句用的标签 id:表示当前<select>标签的唯 ...

  9. CSS常用标签

    CSS常用标签 一 CSS文字属性 color : #999999; /*文字颜色*/ font-family : 宋体,sans-serif; /*文字字体*/ font-size : 9pt; / ...

随机推荐

  1. 疑惑的 java.lang.AbstractMethodError: org.mybatis.spring.transaction.SpringManagedTransaction.getTimeout()L

    在MAVEN项目里面,在整合spring和mybatis在执行数据库操作的时候报出了: java.lang.AbstractMethodError: org.mybatis.spring.transa ...

  2. imadjust从用法到原理—Matlab灰度变换函数之一

    imadjust从用法到原理-Matlab灰度变换函数之一 转摘网址:http://blog.sina.com.cn/s/blog_14d1511ee0102ww6s.html imadjust函数是 ...

  3. 冰球项目日志4-yjw

    小组讨论 我们组编程主要分成三个模块,各自负责自己的编程与测试. 杨静梧:确定击球算法编程.输入:冰球位置,速度大小方向:输出:撞击时冰球中心位置. 曹迦勒:确定击球手速度,位置.输入:撞击时冰球中心 ...

  4. maven 使用

    1. download maven from http://maven.apache.org/ 2. unzip, setup MAVEN_HOME 3. change the configurati ...

  5. nvmw安装,用于控制node版本;

    之前一直使用的是node v2.2.0版本,挺说新版本的node解决了npm安装插件产生文件夹结构过深的问题,所以就想更新试试: 上网一看才发现,尼玛的node已经到了6.+版本了,好吧,看来还是得跟 ...

  6. 使用input range滑块,控制元素transform rotate旋转样式

    <!DOCTYPE html> <html> <head> </head> <body> <!-- 第一步:设置div旋转对象和inp ...

  7. css动画与js动画的区别

    CSS动画 优点: (1)浏览器可以对动画进行优化.   1. 浏览器使用与 requestAnimationFrame 类似的机制,requestAnimationFrame比起setTimeout ...

  8. 【转】[特征选择] An Introduction to Feature Selection 翻译

    中文原文链接:http://www.cnblogs.com/AHappyCat/p/5318042.html 英文原文链接: An Introduction to Feature Selection ...

  9. linq 日期分组统计

     #region        string Condition(DateTime date, string type)        {            if (date == null)   ...

  10. 转载:[AngularJS系列] 那伤不起的provider们啊~ (Provider, Value, Constant, Service, Factory, Decorator)

    来源:http://hellobug.github.io/blog/angularjs-providers/ 用AngularJS做项目,但凡用过什么service啊,factory啊,provide ...