请问我在myeclipse下搭建了SSH框架后,我做jsp网页为什么js和css都没效果

<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<base href="<%=basePath%>">
<title>交院精品课程学习网</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<link href="css/index.css" rel="stylesheet" type="text/css"/>
<script language="javascript" type="text/javascript" src="js/nav_js/jquery.min.js"></script>
<script language="javascript" type="text/javascript" src="js/nav_js/jquery.panelslider.js"></script>
<script language="javascript" type="text/javascript" src="js/nav_js/jquery.panelslider.min.js"></script>
<style>
body{
background-image:url(image/bg_pic.jpg);margin:0;padding:0;
text-align:center;
}
#container {
width: 100%;position:relative;
}
#nav{
min-width:700px;
}
h1, h2 { margin-top: 0; }
p { color: #ccc; line-height: 1.5; }
#page { width: 940px; height: 400px; padding: 20px; margin: 0 auto; background: white; }
.panel {
display: none;
width: 220px;
padding: 20px;
background-color: #333;
color: #fff;
box-shadow: inset 0 0 5px 5px #222;
}

</style>
</head>
<body>
<form>
<div id="container">
<div id="nav">
<ul>
<li>123</li>
<li>123</li>
</ul>
</div>
<a id="left-panel-link" href="#left-panel">打开左面板</a> |
<a id="right-panel-link" href="#right-panel">打开右面板</a>
<!-- Left panel -->
<div id="left-panel" class="panel">
<h2>Left panel</h2>
<p>Click anywhere outside panel to close it.</p>
</div>
<!-- Right panel -->
<div id="right-panel" class="panel">
<h2>Right panel</h2>
<p>Clicking outside this panel wont close it because <code>clickClose = false</code></p>
<button id="close-panel-bt">Close</button>
</div>
</div>
<script>
$('#left-panel-link').panelslider();
$('#right-panel-link').panelslider({side: 'right', clickClose: false, duration: 200 });
$('#close-panel-bt').click(function() {
$.panelslider.close();
});
</script>
</form>
</body>

</html>
css和js都没用,路径是对了的

第1个回答  2014-10-17
是不是被拦截了?在配置里面把js和css文件配成不被拦截的文件追问

就是不需要验证么?我也设置的了,还是不行

追答

有用拦截器吗?拦截器那里也要配。

追问

拦截器哪里大概怎么弄哪,我自学的,才起步,不太懂,,,谢谢了!!!

追答

那估计你没使用拦截器吧。springMVC的XML文件配置你js和CSS所在的路径应该就可以通过了。

<!--静态资源访问 因为在web.xml配置了拦截所有请求“/”所有要配上这句代码  -->
<mvc:resources location="/image/" mapping="/image/**"/> 
<mvc:resources location="css" mapping="/css/**"/>-->
<mvc:resources location="/js/" mapping="/js/**"/>

本回答被网友采纳
第2个回答  2014-10-17
<base href="<%=basePath%>">
相似回答