相关文章推荐
文雅的开水瓶  ·  淘宝生了天猫,联联生了千千,这一波很像! 还 ...·  3 月前    · 
星星上的斑马  ·  -yingdan小镇公交车尺寸_哔哩哔哩_b ...·  12 月前    · 
爽快的四季豆  ·  考研资料搜索渠道推荐之百度网盘 - 知乎·  1 年前    · 
乖乖的数据线  ·  查询未使用绑定变量的SQL,硬解析SQL语句 ...·  1 年前    · 
发呆的抽屉  ·  c语言将uint8_t数组以16进制格式输出 ...·  1 年前    · 
小百科  ›  在jsp页面里面设置全局引用文件开发者社区
脚本 js代码 js jsp
温文尔雅的菠萝
1 年前
作者头像
王小婷
0 篇文章

在jsp页面里面设置全局引用文件

前往专栏
腾讯云
开发者社区
文档 意见反馈 控制台
首页
学习
活动
专区
工具
TVP
文章/答案/技术大牛
发布
首页
学习
活动
专区
工具
TVP
返回腾讯云官网
社区首页 > 专栏 > 编程微刊 > 在jsp页面里面设置全局引用文件

在jsp页面里面设置全局引用文件

作者头像
王小婷
发布 于 2018-06-01 16:12:59
1.3K 0
发布 于 2018-06-01 16:12:59
举报

head.jsp文件

将项目中所需要用到次数比较多的的插件,库等,同意放在一个jsp文件里面,命名为head.jsp文件,相当于一个全局的

<%@ page language="java" contentType="text/html; charset=UTF-8"
   pageEncoding="UTF-8"%>
<!-- 导入标签库 -->
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags" %>
<meta charset="utf-8"/>
<meta name="renderer" content="webkit"><!--360默认极速模式-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<meta content="" name="description"/>
<meta content="" name="author"/>
<!-- 设置全局变量 -->
<base href="<%=request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()%><c:url value="/"/>"/>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<link href="${ctx}/css/common/font-awesome.min.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/common/ionicons.min.css" rel="stylesheet" type="text/css" />
<link href="${ctx}/css/common/AdminLTE.css" rel="stylesheet" type="text/css" /> 
<link href="${ctx}/css/global/optimize.css" rel="stylesheet" type="text/css" />
<!-- jQuery插件 -->
<script src="${ctx}/js/global/jquery/jquery.min.js"></script>
<script src="${ctx}/js/global/jquery-file-upload/js/vendor/jquery.ui.widget.js"></script>
<script src="${ctx}/js/global/jquery-file-upload/js/jquery.iframe-transport.js"></script>
<script src="${ctx}/js/global/jquery-file-upload/js/jquery.fileupload.js"></script>
<!--  日历插件-->
<script  src="${ctx}/js/global/date/jedate/jedate.js"></script>
<!-- bootstrap插件 -->
<link href="${ctx}/css/common/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="${ctx}/js/global/bootstrap/bootstrap.min.js" type="text/javascript"></script>
<!-- 新版 -->
<link href="${ctx}/js/global/bootstrap-table/bootstrap-table.min.css" rel="stylesheet"> 
<script src="${ctx}/js/global/bootstrap-table/bootstrap-table.min.js"></script> 
<script src="${ctx}/js/global/bootstrap-table/bootstrap-table-zh-CN.min.js"></script> 
<!--左侧滑动 -->
<script src="${ctx}/js/global/AdminLTE/app.js" type="text/javascript"></script>
<!-- layer插件 -->
<script src="${ctx}/js/global/layer/layer.js" type="text/javascript"></script>
<script type="text/javascript">
    var pathName=window.document.location.pathname;
    var ROOT=pathName.substring(0,pathName.substr(1).indexOf('/')+1); 
</script>

在每个模块的jsp文件里面 不需要在一次引入bootstrap插件,layer插件,jQuery插件,只需要在head和meta之间写上这段代码<%@include file="../include/head.jsp"%> ,引入head.jsp文件即可,简单方面,不需要再一次在每个jsp页面重复引入所需要的或者删掉不需要的,提高了效率。

<head>
<!-- 引入各种头文件 -->
<%@include file="../include/head.jsp"%> 
 
推荐文章
文雅的开水瓶  ·  淘宝生了天猫,联联生了千千,这一波很像! 还记得上次大师兄介绍过的联联返现吗?发现几个小秘密——免费领价值475元的文旅补贴等{发现几... - 雪球
3 月前
星星上的斑马  ·  -yingdan小镇公交车尺寸_哔哩哔哩_bilibili
12 月前
爽快的四季豆  ·  考研资料搜索渠道推荐之百度网盘 - 知乎
1 年前
乖乖的数据线  ·  查询未使用绑定变量的SQL,硬解析SQL语句 - 墨天轮
1 年前
发呆的抽屉  ·  c语言将uint8_t数组以16进制格式输出_打印uint8_t数组-CSDN博客
1 年前
今天看啥   ·   Py中国   ·   codingpro   ·   小百科   ·   link之家   ·   卧龙AI搜索
删除内容请联系邮箱 2879853325@qq.com
小百科 - 百科知识指南
© 2024 ~ 沪ICP备11025650号