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; / ...
随机推荐
- Linux安装时内存如何分区的相关问题
Linux系统安装时内存如何分区:Linux系统必须的分区是根分区(/)和swap交换分区.普通用户一般分三个区,一个根分区(/),一个家目录(home分区),一个交换分区(swap分区),以80G的 ...
- UIStackView使用 (堆视图)
一基本使用 1创建多个子控件 for (int i = 0; i < 3; i++) { UIButton *imgBtn = [UIButton buttonWithType:UIButton ...
- easymock所测试的方法内部新NEW对象的处理
问题:当记录的方法的参数是方法所在类内部新NEW的对象时,静态的记录方法交互就会失效,例如 调用的方法: public calss A{ public void method(User u){ u.s ...
- springmvc的foward和redirect跳转简单解析
Spring MVC 中,我们在返回逻辑视图时,框架会通过 viewResolver 来解析得到具体的 View,然后向浏览器渲染.假设逻辑视图名为 hello,通过配置,我们 配置某个 ViewRe ...
- Libpci库的调用
这几天发现在Redhat AS6.5 X86_64下用outl(index, 0xcf8)和inl(0xcfc)下读取PCIe配置空间是系统有时性的会hang, 于是去寻找解决方案,首先想到的是用/d ...
- java maven strom 启动异常
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/storm/topology/IRich ...
- MySQL学习记录--分组与聚集
一.group by 子句 group by 字句可对数据进行分组. 以MySQL5.5的sakila数据库中的film数据表举例:查找出各个电影等级的电影总数 mysql>SELECT rat ...
- CSS样式应用
CSS样式应用的方法: (1)行内样式,将css样式直接放到标签当中,一般都是放入标签的style属性中,它是最方便的一种样式,也是最不方便修改的样式.如下: (2)内嵌式,通过将css写在网页源文件 ...
- 即时聊天IM之二 openfire 整合现有系统用户
合肥程序员群:49313181. 合肥实名程序员群:128131462 (不愿透露姓名和信息者勿加入) Q Q:408365330 E-Mail:egojit@qq.com 综述: ...
- 安装.Net Framework3.5
Dism /online /enable-feature /featurename:NetFX3 /All /Source:V:\sources\sxs /LimitAccess