Thymeleaf的一些操作
1. js取值
<script th:inline="javascript">
var message = [[${message}]];
console.log(message);
</script>
2. for循环
<tr th:each="collect,iterStat : ${collects}">
<th scope="row" th:text="${collect.id}">1</th>
<td >
<img th:src="${collect.webLogo}"/>
</td>
<td th:text="${collect.url}">Mark</td>
<td th:text="${collect.title}">Otto</td>
<td th:text="${collect.description}">@mdo</td>
<td th:text="${terStat.index}">index</td>
</tr>
iterStat称作状态变量,属性有:
- index:当前迭代对象的index(从0开始计算)
- count: 当前迭代对象的index(从1开始计算)
- size:被迭代对象的大小
- current:当前迭代变量
- even/odd:布尔值,当前循环是否是偶数/奇数(从0开始计算)
- first:布尔值,当前循环是否是第一个
- last:布尔值,当前循环是否是最后一个
3. 自定义属性用法
th:attr="value=#{obj.value},title=#{obj.title}"
Thymeleaf的一些操作的更多相关文章
- Thymeleaf使用说明
Thymeleaf使用说明 javascript操作: a.<script type="text/javascript" th:inline="javascript ...
- SpringBoo-Thymeleaf
SpringBoo-Thymeleaf SpringBoo-Thymeleaf简介 SpringBoot并不推荐使用JSP,它推荐我们使用模板引擎Thymeleaf,它与Velocity.Free ...
- SpringBoot-Web-初见
目录 怎么开发一个网站? 静态资源 找到静态资源的存放目录 扩展自定义路径 首页定制 模板引擎Thymeleaf 员工管理系统-初见 国际化 国际化实现 编写国际化配置类 登陆功能 编写index.h ...
- 【原】无脑操作:IDEA + maven + SpringBoot + JPA + Thymeleaf实现CRUD及分页
一.开发环境: 1.windows 7 企业版 2.IDEA 14 3.JDK 1.8 4.Maven 3.5.2 5.MariaDB 6.SQLYog 二.Maven设置: Maven目录下的con ...
- 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础授权权限
上一篇<[原]无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限>介绍了实现Shiro的基础认证.本篇谈谈实现 ...
- 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限
开发环境搭建参见<[原]无脑操作:IDEA + maven + SpringBoot + JPA + Thymeleaf实现CRUD及分页> 需求: ① 除了登录页面,在地址栏直接访问其他 ...
- SpringBoot整合Thymeleaf表单更新操作
对于表单值回显并更新的逻辑相比大家都已经很熟悉了, 但是我们操作Thymeleaf的话这里就会有一点小坑了, 在要回显值的表单的所有字段上,我们都要加上 th:field,才可以完成回显值更新 或者这 ...
- 当Thymeleaf遇到向js中传值的操作
在使用Thymeleaf的时候.关于一些点击操作非常头疼.往往需要向JS里面传递各种东西. 然而,在用Thymeleaf的时候.js操作需要拼接语句.但是又不好拼接. 关于一些操作,一般也是在表格中. ...
- Spring mybatis thymeleaf 基础操作,实现数据展示,修改,删除,查询
目录结构如图 index.html <!DOCTYPE html> <html lang="en" xmlns:th="http://www.thyme ...
随机推荐
- waitpid 函数详解
关于Linux中waitpid函数的一些使用说明: #include<sys/types.h> #include<sys/wait.h> 定义函数 pid_t waitpid( ...
- HDU 6321 Dynamic Graph Matching
HDU 6321 Dynamic Graph Matching (状压DP) Problem C. Dynamic Graph Matching Time Limit: 8000/4000 MS (J ...
- A计划 HDU - 2102
A计划 Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submiss ...
- oo第三次总结
一.(1)规格化设计的大致发展历史 20世纪60年代,随着大容量.高速度的计算机出现,以及大量语言的新增和软件的不可靠,爆发了所谓的“软件危机”.而针对这个问题,人们提出了规格化设计的解决方法.通过把 ...
- Autofac之类型注册
本次主要学习一下Autofac中实现类型注册的几种方式,这里并不打算一开始就从基于接口开发的服务关联切入,而是先从一个简单的类型注册来学起,虽然实际开发中可能不会这么做,但是个人感觉从这里学起理解能能 ...
- LeetCode 606 Construct String from Binary Tree 解题报告
题目要求 You need to construct a string consists of parenthesis and integers from a binary tree with the ...
- WebSocket(一)-RFC6455
1.官方在线 本地下载 参考翻译:gitbook
- find 详解
find 详解 原文请访问http://itlab.idcquan.com/linux/SHELL/949102.html 当最初登录到系统中时, u m a s k命令确定了你创建文件的缺省模式.这 ...
- 【UNIX环境高级编程】文件I/O
[UNIX环境高级编程]文件I/O大多数文件I/O只需要5个函数: open.read.write.lseek以及close 不带缓冲的I/O: 每个read和write都调用内核中的一个系统调用 1 ...
- 如何去掉wordpress后台notice提示窗口
我们在安装完wordpress插件后,有些会在后台页面弹出一个提示你去收费升级pro版,如下图所示,这无可厚非,基础功能可以免费用,如果要用高级功能可以升级.有些朋友觉得基础功能够用了,又不想看到弹出 ...