Thymeleaf模板布局
⒈定义片段
1.使用th:fragment
<div th:fragment="copy">
© 2019 <a href="http://www.coreqi.cn">Coreqi</a>
</div>
2.不使用th:fragment
<div id="copy-section">
© 2019 <a href="http://www.coreqi.cn">Coreqi</a>
</div>
⒉引用片段
1.引用使用th:fragment的片段
<div th:insert="~{footer :: copy}"></div>
2.引用不使用th:fragment的片段
<div th:insert="~{footer :: #copy-section}"></div>
⒊引用模板使用的th:insert、th:replace、th:include三者之间的区别
- th:insert 将简单地插入指定的片段作为正文的主标签
- th:replace 用指定实际片段来替换其主标签
- th:include 类似于th:insert,但不是插入片段,而是只插入此片段的内容(3.x版本后不再推荐使用)
Thymeleaf模板布局的更多相关文章
- thymeleaf 模板布局
八.模板布局(Template Layout) 8.1 包含模板片段(Including template fragments) 定义和引用片段 我们通常想要从别的模板文件中调用一些模板片段,例如 页 ...
- Thymeleaf 模板布局三种区别
- Thymeleaf 模板
Thymeleaf 模板布局 th:fragment.th:replace.th:insert.th:remove th:fragment 模板布局 模板片段说明 模板中,经常希望从其他模板中包含⼀ ...
- Springboot 使用thymeleaf模板layout布局
使用layout布局前应该在pom文件中导入thymeleaf(dialect)依赖:如下 <properties> <project.build.sourceEncoding> ...
- (八)Thymeleaf的 th:* 属性之—— 模板布局& th:with& 属性优先级
3.7 模板布局 模板名称:layout.html 3.7.1 th:fragment e.g.模板名为footer.html页面body部分如下: <body> <div th:f ...
- Thymeleaf模板的使用
使用模板的要点: 页面主体结构固定,具体参数可变,尽可能让参数动态化,才能提高模板的复用性 ================================================== ...
- thymeleaf模板的使用(转)
作者:纯洁的微笑 出处:http://www.ityouknow.com/ 在上篇文章springboot(二):web综合开发中简单介绍了一下thymeleaf,这篇文章将更加全面详细的介绍thym ...
- Java 前端模板引擎学习:thymeleaf 模板引擎
模板引擎接口 ITemplateEngine 一.后台数据与外部数据 1.处理后台数据 $表达式是个变量表达式,用于处理在 request parameters and the request, s ...
- 4.3 thymeleaf模板引擎的使用
参考说明:以下笔记参考来自尚硅谷springboot教学中的笔记! thymeleaf官网docs: https://www.thymeleaf.org/documentation.html 模板引擎 ...
随机推荐
- qt: 打不开png图像以及opencv加载中文路径问题;
经过亲测, QT(版本: 5.9.4)提供的QImageReader或者函数load在加载本地png图像时,均会提示失败, 按照网上的方法,将Qt plugins下的imageformats 拷贝到e ...
- Hibernate的入门(增删改查):
注意:本次的记录是在上一篇Hibernate入门的基础上应用的 1.目录 2.实体类修改 package com.itheima.domain; /* * 客户的javaBean * @author ...
- nginx暴露目录文件
location /apk_download { alias /usr/share/nginx/html/; include mime.types; default_type application/ ...
- Xenserver之设置Xenserver和VM机开机自动启动
一.设置Xenserver开机自动启动 [root@xenserver-DS-TestServer09 ~]# xe pool-list uuid ( RO) : b1c803a6-88cf-7b24 ...
- Linux记录-lsof打开文件工具常用操作
lsof `which httpd` //那个进程在使用apache的可执行文件 lsof /etc/passwd //那个进程在占用/etc/passwd lsof /dev/hda6 //那个进程 ...
- HTML汇总以及CSS的一些开端
一.HTML初探 1.HTML(HyperText Markup Language):超文本标记语言指的就是超跃了txt文件,能够在里面进行一些例如:就是指页面内可以包含图片.链接 .甚至音乐.程序等 ...
- 【leetcode-66】 加一
给定一个由整数组成的非空数组所表示的非负整数,在该数的基础上加一. 最高位数字存放在数组的首位, 数组中每个元素只存储一个数字. 你可以假设除了整数 0 之外,这个整数不会以零开头. 示例 1: 输入 ...
- ACM-ICPC 2018 焦作赛区网络预赛 J Participate in E-sports(大数开方)
https://nanti.jisuanke.com/t/31719 题意 让你分别判断n或(n-1)*n/2是否是完全平方数 分析 二分高精度开根裸题呀.经典题:bzoj1213 用java套个板子 ...
- UVA - 1328 Period(循环节kmp)
https://vjudge.net/problem/UVA-1328 题意 求每个前缀的最小循环节,要求至少循环两次且为完整的. 分析 求next数组,i-next[i]即为前缀i的最小循环节,再判 ...
- ubuntu主题收集
ubuntu主题收集 一些cmd常用命令: 任务栏底部,进入Dash并打开终端,命令最后一个是参数可选 ( Left | Bottom ) gsettings set com.canonical.Un ...