jsp路径默认不是项目跟路径
一、
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <% String path = request.getContextPath(); String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/"; %> <!doctype html> <html> <head> <base href="<%=basePath%>"> --------------------加入base,以后默认都是项目跟路径 <meta charset="utf-8"> <title>大客户网络维护管理系统</title> <jsp:include page="common/header.jsp"/> <script type="text/javascript" src="app/js/video/video.js"></script> </head>
二、每个都设置绝对路径
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> <c:set var="ctx" value="${pageContext.request.contextPath}" ---------------绝对路径 scope="request" /> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head id="Head1"> <title>漂亮的easyui后台框架演示-css后台模板-www.16sucai.com</title> <link href="${ctx}/app/easyui/css/default.css" rel="stylesheet" --------------绝对路径 type="text/css" /> <link rel="stylesheet" type="text/css" href="${ctx}/app/easyui/js/themes/default/easyui.css" /> <link rel="stylesheet" type="text/css" href="${ctx}/app/easyui/js/themes/icon.css" /> <script type="text/javascript" src="${ctx}/app/easyui/js/jquery-1.4.2.min.js"></script> <script type="text/javascript" src="${ctx}/app/easyui/js/jquery.easyui.js"></script> <script type="text/javascript" src='${ctx}/app/easyui/js/outlook2.js'> </script>
三、上述两者可以结合使用
<base href="${pageContext.request.contextPath}">