关于thymeleaf th:replace th:include th:insert 的区别
关于thymeleaf th:replace th:include th:insert 的区别
th:insert :保留自己的主标签,保留th:fragment的主标签。
th:replace :不要自己的主标签,保留th:fragment的主标签。
th:include :保留自己的主标签,不要th:fragment的主标签。(官方3.0后不推荐)
例子
<span style="font-family:SimHei;font-size:18px;">需要替换的片段内容: //copy代码片
<footer th:fragment="copy">
<script type="text/javascript" th:src="@{/plugins/jquery/jquery-3.0.2.js}"></script>
</footer>
依次导入
<div th:insert="footer :: copy"></div>
<div th:replace="footer :: copy"></div>
<div th:include="footer :: copy"></div>
结果
<div>
<footer>
<script type="text/javascript" th:src="@{/plugins/jquery/jquery-3.0.2.js}"></script>
</footer>
</div> <footer>
<script type="text/javascript" th:src="@{/plugins/jquery/jquery-3.0.2.js}"></script>
</footer> <div>
<script type="text/javascript" th:src="@{/plugins/jquery/jquery-3.0.2.js}"></script>
</div>
关于thymeleaf th:replace th:include th:insert 的区别的更多相关文章
- MySQL replace into 说明(insert into 增强版)
MySQL replace into 说明(insert into 增强版) 在插入数据到一个表时,通常是这种情况:1. 先推断数据是否存在: 2. 假设不存在,则插入:3.假设存在,则更新. 在 S ...
- MySQL replace into 用法(insert into 的增强版)
转 http://blog.csdn.net/risingsun001/article/details/38977797 MySQL replace into 用法(insert into 的增强版) ...
- php中include()和require()的区别
1.引用文件方式 对 include()来说,在include()执行时文件每次都要进行读取和评估:而对于require()来说,文件只处理一次(实际上,文件内容替换 了require()语句.这就意 ...
- [转]require(),include(),require_once()和include_once()区别
require(),include(),require_once()和include_once()区别 面试中最容易提到的一个PHP的问题,我想和大家共勉一下: require()和include() ...
- 转发(request.setRequestDispacter)和重定向(response.sendRedirect)的区别以及转发的include和forward的区别
//response 重定向的时候,url是会跳转到新的页面的,输入的地址要包含项目名(可以跳到项目之外的页面,比如百度)//request 请求转发的时候,url是不会跳转到新页面的,输入的地址不包 ...
- 关于require,require_once,include和include_once的区别
一.定义 require,require_once,include,include_once都属于PHP的关键字,也就是说它们实际都是PHP的语句,而不是函数,类似于print,echo一样,也是PH ...
- PHP中include和require的区别
include和require的区别,其实两者没有太大的区别,如果要包含的文件不存在,include提示notice,然后继续执行下面的语句,require提示致命错误并且退出. 根据测试,win32 ...
- php引入文件(include 和require的区别)
引入文件: 首先需要一个php文件: <?php class shao//类名必须和文件名相同!!! { public $xxx="666"; } $shili = new ...
- php require、require_once和include、include_once的区别
一.引入php文件路径的方法require '文件路径'; require ('文件路径');require_once '文件路径'; require_once ('文件路径');include 同 ...
随机推荐
- gdb-peda调试总汇
gdb-peda调试总汇 break *0x400100 (b main):在 0x400100 处下断点 tb一次性断点 info b:查看断点信息 delete [number]:删除断点 wat ...
- Spring中报"Could not resolve placeholder"的解决方案
除去properites文件路径错误.拼写错误外,出现"Could not resolve placeholder"很有可能是使用了多个PropertyPlaceholderCon ...
- LXC学习实践(1)LXC的概念和用途
1.LXC是什么? LXC是Linux containers的简称,是一种基于容器的操作系统层级的虚拟化技术,Sourceforge上有LXC这个开源项目. 2.LXC能做什么? LXC和Linux内 ...
- 阿里云API网关(3)快速入门(调用 API)
网关指南: https://help.aliyun.com/document_detail/29487.html?spm=5176.doc48835.6.550.23Oqbl 网关控制台: https ...
- Spring Security入门(3-4)Spring Security 异常处理、异常传递和异常获取
- leetcode算法:Trim a Binar Search Tree
Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that a ...
- Web开发笔记
jquery ui draggable clone之后不会克隆draggable功能,要重新设置
- FTP文件上传到HDFS上
在做测试数据时,往往会有ftp数据上传到hdfs的需求,一般需要手动操作,这样做太费事,于是有了下边代码实现的方式: ftp数据上传到hdfs函数: import java.io.InputStrea ...
- Spring(二):Spring框架&Hello Spring
Spring是一个开源框架,是为了解决企业应用程序开发复杂性而创建的.框架的主要优势之一就是其分层架构,分层架构允许您选择使用哪一个组件,同时为J2EE应用程序开发提供集成的框架. Spring 框架 ...
- MyBatis(二):Select语句传递参数的集中方案
从别人说的方案中看出,传递参数方案还挺多,不如自己整理下,以便以后使用过程中有个笔记回忆录. 1.传递一个参数的用法: 配置文件 <select id="getById" r ...