(八)Thymeleaf的 th:* 属性之—— 模板布局& th:with& 属性优先级
3.7 模板布局
3.7.1 th:fragment
<body>
<div th:fragment="copy">
© 2011 The Good Thymes Virtual Grocery
</div>
</body>
3.7.2 th:include and th:replace
<div th:insert="~{footer :: copy}"></div>
<div th:insert="footer :: copy"></div>

3.7.3 th:remove
th:remove可以以五种不同的方式行事,具体取决于它的价值all:删除包含标签及其所有子项。body:不要删除包含的标签,但删除其所有的孩子。tag:删除包含的标签,但不要删除其子项。all-but-first:除去第一个包含标签的所有子项。none: 没做什么。该值对于动态评估是有用的。
<tr th:remove="all">
<td>Mild Cinnamon</td>
<td>1.99</td>
<td>yes</td>
</tr> <a href="/something" th:remove="${condition}? tag : none">Link text not to be removed</a>
3.8 th:with
1.可一次定义多个,逗号分隔
<div th:with="firstPer=${list[0]}">
<p>The name of the first person is <span th:text="${firstPer.userName}">Julius Caesar</span>.</p>
</div>
<div th:with="firstPer=${list[0]},secondPer=${list[1]}">
<p>The name of the first person is <span th:text="${firstPer.userName}">Julius Caesar</span>.</p>
<p> But the name of the second person is <span th:text="${secondPer.userName}">Marcus Antonius</span>.
</p>
</div>
2.可复用
<div th:with="company=${user.company},account=${accounts[company]}">
<div th:text="${company}"></div>
<div th:text="${account}"></div>
</div>
3.9 属性优先级
(八)Thymeleaf的 th:* 属性之—— 模板布局& th:with& 属性优先级的更多相关文章
- thymeleaf 模板布局
八.模板布局(Template Layout) 8.1 包含模板片段(Including template fragments) 定义和引用片段 我们通常想要从别的模板文件中调用一些模板片段,例如 页 ...
- Thymeleaf+SpringMVC,如何从模板中获取数据
Thymeleaf+SpringMVC,如何从模板中获取数据 在一个典型的SpringMVC应用中,带@Controller注解的类负责准备数据模型Map的数据和选择一个视图进行渲染.这个模型Map对 ...
- Thymeleaf+SpringMVC,如何从模板中获取数据(转)
在一个典型的SpringMVC应用中,带@Controller注解的类负责准备数据模型Map的数据和选择一个视图进行渲染.这个模型Map对视图进行完全的抽象,在使用Thymeleaf的情况下,它将是一 ...
- ThinkPHP3.1 模板布局
ThinkPHP的模板引擎内置了布局模板功能支持,可以方便的实现模板布局以及布局嵌套功能.有三种布局模板的支持方式: 第一种方式:全局配置方式 这种方式仅需在项目配置文件中添加相关的布局模板配置,就可 ...
- thinkphp 模板布局
ThinkPHP的模板引擎内置了布局模板功能支持,可以方便的实现模板布局以及布局嵌套功能. 有三种布局模板的支持方式: 第一种方式:全局配置方式 这种方式仅需在项目配置文件中添加相关的布局模板配置,就 ...
- CSS HTML元素布局及Display属性
本篇文章主要介绍HTML的内联元素.块级元素的分类与布局,以及dispaly属性对布局的影响. 目录 1. HTML 元素分类:介绍内联元素.块级元素的分类. 2. HTML 元素布局:介绍内联元素. ...
- [WPF系列]-数据邦定之DataTemplate 根据对象属性切换模板
引言 书接上回[WPF系列-数据邦定之DataTemplate],本篇介绍如何根据属性切换模板(DataTemplate) 切换模板的两种方式: 使用DataTemplateSelecto ...
- Flex布局教程及属性速查
一.Flex布局介绍 伸缩盒模型(flexbox)是一个新的盒子模型,意为"弹性布局",用来为盒状模型提供最大的灵活性,主要优化了UI布局.Flexbox的功能主要包手:简单使用一 ...
- thinkphp多模板布局设置!!
首先开启模板布局要在配置文件添加: 'LAYOUT_ON'=>true, 'LAYOUT_NAME'=>'layout', 如果需要设置多个布局模板,就要先关闭上面的LAYOUT_ON,也 ...
随机推荐
- localhost、127.0.0.1和本机IP
localhost 是个域名,不是地址,它可以被配置为任意的 IP 地址,不过通常情况下都指向 127.0.0.1(ipv4)和 [::1](ipv6) 整个127.* 网段通常被用作 loopbac ...
- Ubuntu16.04搭建LAMP开发环境
Ubuntu16.04搭建LAMP开发环境 虚拟机上安装好Ubuntu16.04后,是一台空白的Ubuntu.我的目的是搭建LAMP环境,顺便搭一个Python Django环境. 基本设置 1.配置 ...
- Ionic 存储目录 CORS
使用不同的存储库结构官方为 { "scripts": { "install": "cd path-to/your-app && npm ...
- A/B Testing with Practice in Python (Part Two)
This is the second part of A/B testing notes, which contains the practical issues and alternatives o ...
- 消息队列集群kafka安装配置
1. 下载wget http://mirror.rise.ph/apache/kafka/0.11.0.0/kafka_2.12-0.11.0.0.tgz2. 安装tar xf kafka_2.12- ...
- unity3d 网页游戏客户端工程构建方案
将一个项目分为两个编辑环境,一个是editor,一个是target. editor只是策划人员拖拖拽拽编辑场景,打包时程序自动将每个场景资源打包生成一个XXX.unity3d文件,并最后生成一个场景配 ...
- shell中的cut命令
转:http://blog.sina.com.cn/s/blog_5e77c61f0100hqky.html cut是以每一行为一个处理对象的,这种机制和sed是一样的.(关于sed的入门文章将在近期 ...
- c#异步线程:同步调用,异步调用,异步回调
定义一个异步线程类: public class AsyEventClass { private static ILog logger = LogManager.GetLogger(MethodBase ...
- [置顶]
docker1.12--docker命令行帮助文档
镜像操作 build 使用dockerfile方式创建镜像 使用dockerfile文件docker build dockerflle/,dockerfile文件默认位于dockerflle/Dock ...
- as well as
一.as well 用法: 1.as well常用作状语,作“又:也”解,相当于too或also,常位于句末,无须用逗号与句子分开.如: I am going to London and my sis ...