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进行抽取,这种方式很有效,但比较老了,另外为了页面的自适应性,还得做不少工作: ...
随机推荐
- android系统下消息推送机制
一.推送方式简介: 当前随着移动互联网的不断加速,消息推送的功能越来越普遍,不仅仅是应用在邮件推送上了,更多的体现在手机的APP上.当我们开发需要和服务器交互的应用程序时,基本上都需要获取服务器端的数 ...
- vue---分页搜索功能
<template> <div> <div class="searc"> <input type="search" p ...
- IOS 常遇到的报错警告 以及 解决办法
1. This application is modifying the autolayout engine from a background thread, which can lead to ...
- hibernate入门程序
快速入门 1. 下载Hibernate框架的开发包 2. 编写数据库和表结构 Create database hibernate_day01; Use hibernate_da ...
- Confluence 6 数据库连接方式
你可以使用 JDBC URL 或者一个 JNDI 数据源来连接 Confluence 到你的数据库. 在默认的设置向导中,只提供了使用 JDBC 数据库连接选项,这个也是推荐的数据库连接选项. 如果你 ...
- 【Web】servlet、filter和listener
一般地,servlet.filter.listener是配置到web.xml中(web.xml 的加载顺序是:context-param -> listener -> filter -&g ...
- axis 数据流
产生数据流的代码 模板 重新修改了下 :]axis_data_cnt='d0; :]axis_data_frame_cnt='d0; :]delay_cnt='d0; initial begin ...
- 【linux】复制文件夹中文件,排除部分文件
如下 cp `ls|grep -v -E '*json|out'|xargs` /home/data/ 用grep -v 表示排除, -E 表示正则 ls|grep -v -E '*json|out ...
- PDF文件编辑技巧之PDF书签怎么设置
纸质的文件想要添加书签就直接拿笔书写就可以,Word文件怎么添加书签相信大家也都知道,那么PDF文件的书签要怎么设置的呢,是不是有很多小伙伴不知道该怎么做呢,不要担心,今天小编就来跟大家分享一下在PD ...
- WIN 7 使用shutdown命令设置电脑自动关机
使用组合键“WIN + R”,在弹出的对话窗“运行”中输入“cmd”,点击“确定”按钮或直接按回车键“Enter”. 设置电脑在一定时间后关机,比如60分钟,在弹出的对话框中,输入“shutdown ...
