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,也可以用 ...
随机推荐
- Java多线程:AQS
在Java多线程:线程间通信之Lock中我们提到了ReentrantLock是API级别的实现,但是没有说明其具体实现原理.实际上,ReentrantLock的底层实现使用了AQS(AbstractQ ...
- SVN Error:请求的名称有效并且在数据库中找到,但是它没有相关的正确的数据来被解析
同事安装配置完Svn后一直down不下来文件,报错内容如下: Administrator 18:07:27 Checkout from https:/svn/web, revision HEAD, ...
- oracle-用户和表空间创建
windows下 创建临时表空间 create temporary tablespace user_temp tempfile 'D:\oracle\oradata\Oracle11i\user_te ...
- Andorid源码 4.4 TAG
Fetching project platform/frameworks/opt/timezonepickerremote: Counting objects: 11169, doneremote: ...
- 最经典的常用拍照姿势大全,顶级POSE
伸出手遮阳光. 捂住一只眼睛. 手放在最旁.这是一个极具诱惑的姿势 站立,背对镜头,扭过来,仰角拍, 俩手按在头两边,歪头,或者直头,表情一般都困惑,迷茫,咬下嘴唇效果更佳. ...
- maven打包含有多个main程序的jar包及运行方式
pom.xml <build> <plugins> <plugin> <groupId> ...
- Ubuntu 13.10 解决虚拟机摄像头无法使用问题
前段时间使用的是Ubuntu 13.04,使用virtualbox虚拟机 4.2版,虚拟机里边装的Windows 7和Windows8.1均无法使用摄像头.只要在USB设备中选上了摄像头,虚拟机系统准 ...
- Winform开发框架之通用附件管理模块 --SNF快速开发平台3.3-Spring.Net.Framework
最近项目太多都没有时间写文章了,实际项目需求一,CS端和windows平板都需要附件上传管理功能.以前做的都是BS的附件管理和上传功能.本来计划在Winform上嵌套一个浏览器直接用bs的附件上传功能 ...
- docker镜像、容器以及命令操作
docker image docker image是一个极度精简版的Linux程序运行环境,官网的java镜像包括的东西更少,除非是镜像叠加方式的如centos+java7 docker image是 ...
- ab压力测试工具的简单使用
ab是一种用于测试Apache超文本传输协议(HTTP)服务器的工具.apache自带ab工具,可以测试 apache.IIs.tomcat.nginx等服务器 但是ab没有Jmeter.Loadru ...