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,也可以用 ...
随机推荐
- GemFire 入门篇2:GemFire 8.2 在CentOS & Mac OS X的安装步骤
GemFire目前已经开源,开源项目的主页:http://geode.incubator.apache.org/,商业版本的主页:https://pivotal.io/big-data/pivotal ...
- 解决Cordova开发的iOS的app界面被状态栏覆盖
解决方法如下: 一:在MainViewController.m中添加如下代码: -(void)viewWillDisappear:(BOOL)animated { if([[[UIDevice cur ...
- springboot自定义http反馈状态码
最近在开发一些http server类型程序,通过spring boot构建一些web程序,这些web程序之间通过http进行数据访问.共享,如下图: 假设现在client发起一次保存数据的请求到se ...
- Android典型界面设计——FragmentTabHost+Fragment实现底部tab切换
一.问题描述 在上次博文中,我们使用RadioGroup+ViewPage+Fragmen实现了顶部滑动导航(查看文章:http://www.cnblogs.com/jerehedu/p/460759 ...
- 职场之KPI
当一个公司开始执行KPI考核的时候,任何人的工作性质就发生了变化,而处于底层的员工就惨了,因为一个公司的资源是有限的,一个人的精力也是有限的,当你和你上司负责不同的项目时,而当你的所谓产品经理负责两个 ...
- 【T02】理解子网和CIDR的概念
1.IP地址分为5类,A.B.C.D.E,它们的前缀分别是: A:0 网络个数2^7,主机个数2^24,大概1千6百万 B:10 网络个数2^14,大概1万6千,主机个数2^16,大概6万5千 C:1 ...
- leetcode笔记:Validate Binary Search Tree
一. 题目描写叙述 Given a binary tree, determine if it is a valid binary search tree (BST). Assume a BST is ...
- StringBuilder在高性能场景下的正确用法
转载:<StringBuilder在高性能场景下的正确用法> by 江南白衣 关于StringBuilder,一般同学只简单记住了,字符串拼接要用StringBuilder,不要用+,也不 ...
- 让WebService支持Get请求
在C#中,新建一个webservice,默认是post类型的.如果需要支持Get请求,需要对web.config文件进行配置 <system.web> <compilation de ...
- ceph 生成rpm包
概述 从ceph的源码build出rpm包: #git clone --recursive https://github.com/ceph/ceph.git #./instal-dep.sh 以上两点 ...