thymeleaf常用标签
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常用标签的更多相关文章
- thymeleaf 常用标签
1.th:field th:field="*{user.sex}" 此标签会自动填充数据,比如用户的性别 user.sex 如果不为空,则会自动勾选上 2.th:each=&qu ...
- 4.Thymeleaf的常用标签
一.常用标签 二.foreach案例 1.创建项目 2. 创建Student.java package cn.kgc.pojo; /** * Created by Administrator on 2 ...
- SpringBoot入门系列(五)Thymeleaf的常用标签和用法
前面介绍了Spring Boot 中的整合Thymeleaf .不清楚的朋友可以看看之前的文章:https://www.cnblogs.com/zhangweizhong/category/16577 ...
- HTML常用标签
HTML常用标签: HTML文档格式: 首先,HTML是一种超文本标签语言,它是制作网页的基础. 其次,HTML文档中至少包含基本的和成对的<html> </html>.< ...
- html常用标签介绍
常用标签介绍 文本 最常用的标签可能是<font>了,它用于改变字体,字号,文字颜色. 点击查看效果 <font size="6">6</font&g ...
- HTML常用标签总结
HTML 的常用标签总结 <font size="字体大小1-7" color="red或0xff00ff" face="字体类型(楷体等)&q ...
- html新增一些常用标签
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- [刘阳Java]_MyBatis_映射文件的常用标签总结_第5讲
MyBatis中常用标签的总结,简单给出自己的总结 MyBatis映射文件中的标签使用介绍1.<select>:用于编写查询语句用的标签 id:表示当前<select>标签的唯 ...
- CSS常用标签
CSS常用标签 一 CSS文字属性 color : #999999; /*文字颜色*/ font-family : 宋体,sans-serif; /*文字字体*/ font-size : 9pt; / ...
随机推荐
- YYYY-mm-dd HH:MM:SS
备忘:YYYY-mm-dd HH:MM:SS部分解释 d 月中的某一天.一位数的日期没有前导零. dd 月中的某一天.一位数的日期有一个前导零 ...
- Perl--学习记录(实时更新)
标量变量(varibale)以美元符号($)开头,这个符号也成为魔符(sigil).Perl通过魔符来区分它是什么类型的变量. Perl里面大部分变量名称习惯使用全小写.而使用全大写的(比如$ARGV ...
- 自定义scrollview右侧的滑动条
在做这个功能之前我其实是拒绝的,为什么这么说呢,因为我怕麻烦啊!(开玩笑的,怕麻烦就不做程序员了) 很久没有写博客,这次刚好项目中有个有趣的东西,想拿出来分享一下,希望能帮到某些小伙伴. 首先说说需求 ...
- ssh用户登录
1.搭建环境,连数据库,建包建类 2.Admin,这是表,表必须有主码 package com.chao.db; /** * Admin entity. @author MyEclipse Persi ...
- mysql大数据分表记录app用户的坐标数据
最近提到一个需求.需要记录app用户在使用app中的移动轨迹,即坐标值.每分钟上传一次XY坐标,有点类似跑步软件的描线轨迹. 不考虑app如何获取,反正api只要接受到坐标数据 就记录下来保存到数据库 ...
- HTTP性能小测试
一直说node.js如何如何好,就来测试一下吧~~ 首先接受一个小工具 Apache Bench简称ab 可以用来测试http性能 利用Apache Bench测试Web引擎性能关于此工具的详细介绍参 ...
- response 下载文件
String basePath = "D://test.json"; String filename = basePath.substring(basePath.lastIndex ...
- 网页边框样式与style样式部分总结
1).border边框样式:border-style:solid 边框样式值如下: none : 无边框.与任何指定的border-width值无关 hidden : 隐藏边框.IE不支持 dotte ...
- (01-02) odoo8.0_Ubuntu14.04_nginx反代理设置
作者:陈伟明联系 : QQ 942923305 | 微信 toby942923305E-mail: cwm.win@hotmail.com============================== ...
- (44) odoo中的WebService
* 前言 erp系统会和其它系统进行对接,这时就要接口,官方给出的是两解决方案 * XML-RPCLibrary 举例 import xmlrpclib root = 'http:// ...