themeleaf引入公共页面
<div th:include="/top :: html"></div>
//引用公共页面
<div th:replace="head"></div>
//引用公共js
<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org"
xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"
th:with='basePath=${#httpServletRequest.getScheme()+"://"+#httpServletRequest.getServerName()+":"+#httpServletRequest.getServerPort()+#httpServletRequest.getContextPath()+"/"}'>
<head th:fragment="head">
<base th:href="${basePath}"/>
<meta value="UTF-8"/>
<script th:src="@{/js/jquery-3.1.1.min.js}"></script>
<script th:src="@{/js/moment.js}"></script>
<script th:src="@{/js/vue.min.js}"></script>
<script th:src="@{/js/vdt.js}"></script>
<script th:src="@{/js/vue-router.min.js}"></script>
<script th:src="@{/js/vue-resource.min.js}"></script>
<script th:src="@{/js/axios.min.js}"></script>
<script th:src="@{/js/tool.js}"></script>
<script th:src="@{/element-ui/lib/index.js}"></script>
<script th:src="@{/js/vee-validate/vee-validate.min.js}"></script>
<script th:src="@{/js/vee-validate/vee-zh_CN.js}"></script>
<script th:src="@{/js/fingerprint2.min.js}"></script>
<link rel="stylesheet" th:href="@{/element-ui/lib/theme-chalk/index.css}" />
<link rel="stylesheet" th:href="@{/css/main.css}" />
<link rel="stylesheet" th:href="@{/css/reset.css}" />
<script th:inline="javascript">
var basepPath = [[${basePath}]];
</script>
</head>
</html>
themeleaf引入公共页面的更多相关文章
- 微信小程序 引入公共页面的几种情况
1.不带参数 首先在pages文件夹中新建一个template文件夹,文件夹中新建一个template.wxml文件,代码如下 <!--template.wxml--> <templ ...
- Thymeleaf静态资源引入方式及公共页面代码抽取
静态资源引入 Thymeleaf模板引擎url问题,要用如下的方式写,确保在任何情况下都能访问到 <!-- Bootstrap core CSS --> <link href=&qu ...
- Thymeleaf引入公共片段方式
引入公共片段 引入公共片段的th属性,包括三种方式 th:insert 将公共片段,整个插入到声明引入的元素中 th:replace 将声明引入的元素,替换为公共片段 th:include 将被引入的 ...
- 通过动态包含和Ajax机制抽取Web应用的公共页面
在Java Web应用开发中,经常遇到的一种情况是,许多的页面中都包含着“公共页面”,这部分动态页面的特征是:访问量大,会带来较大的性能压力.功能设计上会动态地改变自身的元素.比如在登录前和登录后所展 ...
- 11、SpringBoot-CRUD-thymeleaf公共页面元素抽取
thymeleaf公共页面元素抽取 存在一种现象:两个文件的代码只有一部分代码不一样 其余的均相同,此时就可以提取公共的代码去简化开发 .抽取公共片段 <div th:fragment=&quo ...
- 使用iframe引入公共模块
新建一个公共文件head.html <!DOCTYPE html><html lang="en"><head> <meta charset ...
- ThinkPHP5——引入公共部分head和foot(多种方法)
在项目中,header和footer重复使用的次数高,于是我们把header和footer作为公共部分,其他模板需要的话就引用.下面我教大家引用公共模板 1.使用include 首先在view下面新建 ...
- thymeleaf 模板使用 提取公共页面
切记!!!thymeleaf模板的使用,姿势很重要!!!姿势不对,可能导致样式.js等的使用受到影响 前台开发中,由于页面目录结构不同,可能导致引入的公共页面中的的跳转路径在部分页面能用,部分页面不能 ...
- 如何针对Thymeleaf模板抽取公共页面
对于公共页面(导航栏nav.页头head.页尾footer)的抽取有三种方式: 1)基于iframe进行抽取,这种方式很有效,但比较老了,另外为了页面的自适应性,还得做不少工作: ...
随机推荐
- Codeforces 671D Roads in Yusland [树形DP,线段树合并]
洛谷 Codeforces 这是一个非正解,被正解暴踩,但它还是过了. 思路 首先很容易想到DP. 设\(dp_{x,i}\)表示\(x\)子树全部被覆盖,而且向上恰好延伸到\(dep=i\)的位置, ...
- 【MySql】delete用法
delete 语句用于删除表中的数据, 基本用法为: delete from 表名称 where 删除条件; 以下是在表 students 中的实例: 删除 id 为 3 的行: delete fro ...
- java虚拟机内存不足,“Could not create the Java Virtual Machine”问题解决方案
java虚拟机内存不足,"Could not create the Java Virtual Machine"问题解决方案 在运行java程序时,遇到问题"Could n ...
- Confluence 6 自定义默认空间内容
中文标题[自定义默认空间内容] Confluence 管理员 可以编辑用于创建主页和新站点的模板.默认的内容将会在新空间创建后的主页上显示出来.这个与站点空间,个人空间和空间蓝图的模板是不同的. 模板 ...
- jQuery筛选器常用总结
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8" ...
- nodejs 如何获取页面get、post传递过来的参数
如果是get传递参数,可以直接使用 request.query.name 如果是post 需要借助body-parser 首先引入bodyParser = require('body-parser') ...
- 常见的爬虫分析库(2)-xpath语法
xpath简介 1.xpath使用路径表达式在xml和html中进行导航 2.xpath包含标准函数库 3.xpath是一个w3c的标准 xpath节点关系 1.父节点 2.子节点 3.同胞节点 4. ...
- Ubuntu下VS Code 字体设置 + 标签匹配、括号匹配插件
Ubuntu下比较好看的字体有: Courier NewSource Code ProWenQuanYi Micro HeiWenQuanYi Micro Hei MonoUbuntuDroid Sa ...
- .NetCore 下开发独立的(RPL)含有界面的组件包 (三)构建界面
.NetCore 下开发独立的(RPL)含有界面的组件包 (一)准备工作 .NetCore 下开发独立的(RPL)含有界面的组件包 (二)扩展中间件及服 务 .NetCore 下开发独立的(RPL)含 ...
- 将Elasticsearch的快照备份到HDFS
1.安装Elasticsearch插件repository-hdfs 下载地址:https://artifacts.elastic.co/downloads/elasticsearch-plugins ...
