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 模板引擎 ...
随机推荐
- HTTP常用头部信息
下面用例子的形式来记录下常用的一些Http头部信息 Request Header: GET /sample.Jsp HTTP/1.1 //请求行 Host: www.uuid.online/ // ...
- nGrinder TestRunner http post json
s nGrinder学习笔记 — post请求 https://blog.csdn.net/meyoung01/article/details/50435881 import HTTPClient.H ...
- SpringBoot笔记十六:ElasticSearch
目录 ElasticSearch官方文档 ElasticSearch安装 ElasticSearch简介 ElasticSearch操作数据,RESTful风格 存储 检查是否存在 删除 查询 更新 ...
- vue基础篇---watch监听
watch可以让我们监控一个值的变化.从而做出相应的反应. 示例: <div id="app"> <input type="text" v-m ...
- Kafka技术内幕 读书笔记之(二) 生产者——新生产者客户端
消息系统通常由生产者(producer ). 消费者( consumer )和消息代理( broker ) 三大部分组成,生产者会将消息写入消息代理,消费者会从消息代理中读取消息 . 对于消息代理而言 ...
- Shuttle 学习
见 http://blog.csdn.net/liu765023051/article/details/38521039
- Python复习笔记(五)面向对象
1. __init__方法 # 1. 为对象在内存 中分配空间 -- 创建对象 # 2. 为对象属性 设置初始值 -- 初始化方法(init)+-------------- # 3. __init__ ...
- Log4j 1.x JDBCAppender记录日志失效问题详解
官网:http://logging.apache.org/log4j/1.2/manual.html 事件:最近在项目中使用log4j 1.x JDBCAppender记录管理员操作日志到数据库,在测 ...
- termux 开启 sshd
众所周知, termux 上的 sshd 不能通过 IP 连接, 只能使用密钥, 对于使用 PuTTY 的 Windows 用户, 怎么办呢? 由于 PuTTY 支持 telnet, 而 termux ...
- Groovy的脚本统一于类的世界
http://groovy-lang.org/structure.html 3.2. Script class A script is always compiled into a class. Th ...