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}">
?