SpringBoot thymeleaf使用方法,thymeleaf模板迭代
SpringBoot thymeleaf使用方法,thymeleaf模板迭代
SpringBoot thymeleaf 循环List、Map
================================
©Copyright 蕃薯耀 2018年3月27日
http://www.cnblogs.com/fanshuyao/
附件下载见:http://fanshuyao.iteye.com/blog/2414521
一、thymeleaf模板基本显示:
- <div th>thymeleaf模板语言测试</div>
- <div>您好,
- <span class="cc" id="aaa" th:text="${myname}" th:id="${id}"></span>
- </div>
- <div class="cc" id="bbb" th:text="'姓名:'+${myname}" th:id="'id_'+${id}"></div>
二、迭代List
- <div>==========List迭代==============</div>
- <ul>
- <li th:each="data : ${list}" th:text="${data}"></li>
- </ul>
三、students集合对象迭代
- <div>==========students迭代==============</div>
- <ul>
- <li th:each="student : ${students}" th:text="'姓名:' + ${student.name} + ',年龄:' + ${student.age}"></li>
- </ul>
四、students集合对象迭代第二种方式,使用双竖线:|xxxx|
- <div>==========students迭代2,使用双竖线:|xxxx|==============</div>
- <ul>
- <li th:each="student : ${students}" th:text="|姓名:${student.name} ,年龄: ${student.age}|"></li>
- </ul>
五、students集合对象迭代第三种方式,使用中括号:[[]]或[()],这2个的区别在对于特殊字符是否转义
- <div>==========students迭代3,使用中括号:[[]]或[()]==============</div>
- <ul>
- <li th:each="student : ${students}" >姓名:[[${student.name}]],年龄:[(${student.age})]</li>
- </ul>
六、Map迭代
- <div>==========Map迭代==============</div>
- <ul>
- <li th:each="m : ${map}" >key:[[${m.key}]],值:[(${m.value})]</li>
- </ul>
七、模板语言基本用法:(附件在Pdf文档:usingthymeleaf.pdf)
1、基本语法:

2、对应的属性:

================================
©Copyright 蕃薯耀 2018年3月27日
http://www.cnblogs.com/fanshuyao/
SpringBoot thymeleaf使用方法,thymeleaf模板迭代的更多相关文章
- springboot配置server相关配置&整合模板引擎Freemarker、thymeleaf&thymeleaf基本用法&thymeleaf 获取项目路径 contextPath 与取session中信息
1.Springboot配置server相关配置(包括默认tomcat的相关配置) 下面的配置也都是模板,需要的时候在application.properties配置即可 ############## ...
- SpringBoot Web开发(4) Thymeleaf模板与freemaker
SpringBoot Web开发(4) Thymeleaf模板与freemaker 一.模板引擎 常用得模板引擎有JSP.Velocity.Freemarker.Thymeleaf SpringBoo ...
- SpringBoot 整合 Thymeleaf & 如何使用后台模板快速搭建项目
如果你和我一样,是一名 Java 道路上的编程男孩,其实我不太建议你花时间学 Thymeleaf,当然他的思想还是值得借鉴的.但是他的本质在我看来就是 Jsp 技术的翻版(Jsp 现在用的真的很少很少 ...
- springboot之freemarker 和thymeleaf模板web开发
Spring Boot 推荐使用Thymeleaf.FreeMarker.Velocity.Groovy.Mustache等模板引擎.不建议使用JSP. 一.Spring Boot 中使用Thymel ...
- java框架之SpringBoot(4)-资源映射&thymeleaf
资源映射 静态资源映射 查看 SpringMVC 的自动配置类,里面有一个配置静态资源映射的方法: @Override public void addResourceHandlers(Resource ...
- SpringBoot整合Jsp和Thymeleaf (附工程)
前言 本篇文章主要讲述SpringBoot整合Jsp以及SpringBoot整合Thymeleaf,实现一个简单的用户增删改查示例工程.事先说明,有三个项目,两个是单独整合的,一个是将它们整合在一起的 ...
- SpringBoot(四) Web开发 --- Thymeleaf、JSP
Spring Boot提供了spring-boot-starter-web为Web开发予以支持,spring-boot-starter-web为我们提供了嵌入的Tomcat以及Spring MVC的依 ...
- SpringBoot学习笔记(4)----SpringBoot中freemarker、thymeleaf的使用
1. freemarker引擎的使用 如果你使用的是idea或者eclipse中安装了sts插件,那么在新建项目时就可以直接指定试图模板 如图: 勾选freeMarker,此时springboot项目 ...
- 玩转 SpringBoot 2 快速整合 | Thymeleaf 篇
前言 Thymeleaf是一个适用于Web和独立环境的现代服务器端Java模板引擎. Thymeleaf的主要目标是为您的开发工作流程带来优雅的自然模板 - 可以在浏览器中正确显示的HTML,也可以用 ...
随机推荐
- spring boot + embed tomcat + standalone jar的内存泄露问题
前一阵遇到了一个很坑的内存泄露问题,记录于此: 有个项目采用spring cloud重构后,部署到线上(其中有一个接口,大概每天调用量在1千万次左右),发现zabbix监控里,linux的可用内存一直 ...
- ADSL理解
ADSL技术提供的上行和下行带宽不对称,因此称为非对称数字用户线路. ADSL技术采用频分复用技术把普通的电话线分成了电话.上行和下行三个相对独立的信道,从而避免了相互之间的干扰.用户可以边打电话边上 ...
- webservice-整理
webservice-整理 RPC与WebService的区别:https://blog.csdn.net/defonds/article/details/71641634 http://www.di ...
- Tkinter(2.x 与3.X的区别)
1.包的引入 2.X下是 from Tkinter import * 而3.x是 from tkinter import * 否则,会报找不到tkinter的错误 Traceback (most re ...
- 微软BI 之SSIS 系列 - 在 SSIS 输出平面文件时根据运行日期生成不同的文件名称
开篇介绍 在 SSIS 中操作文件的输入和输出是非常方便的,这个例子讲解一个最简单的需求:比如每天从数据库中查询一批数据要输出到文件,每天产生一个文件,那么文件的名称按照"文件名+日期&qu ...
- Fix Corrupt Blocks on HDFS
来自:http://centoshowtos.org/hadoop/fix-corrupt-blocks-on-hdfs/ How do I know if my hadoop hdfs filesy ...
- centos7.4 开启ftp服务
1.安装vsftpd yum install -y ftp vsftpd 2.配置/etc/vsftpd/vsftpd.conf 修改项如下: #不允许匿名访问 anonymous_enable=NO ...
- how to check the computer is 32 bit or 64bit in linux
just use cat /proc/cpuinfo in shell
- 如何将Ubuntu Server 12.04 升级到 Ubuntu Server 14.04 LTS
升级Ubuntu 12.04到Ubuntu 14.04方法如下: 步骤一:在终端中运行下面的命令,它将安装所有的升级包.$ sudo apt-get update && sudo ap ...
- 你真的了解Python吗 ---Python的内存管理
请看下面的一段代码: origin = {'a':100,'b':[1,2,34,5]} obj_copy ={}; print origin; obj_copy['key1']= origin; o ...