<a href="#"></a>本来是不跳转,只是个空连接的,可是今天结合jquery的时候却跳到根目录去了,百思不得其解,后来想起来了,jsp页面中是不是设置了根目录,仔细看代码,发现myeclipse自动生成的jsp页面的确设置了根目录,
<%
String path = request.getContextPath();
String basePath = request.getScheme() + "://"
+ request.getServerName() + ":" + request.getServerPort()
+ path + "/";
%>
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</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 rel="stylesheet" type="text/css" href="styles.css">
-->
<script src="<c:url value="js/jquery.js"/>"
type="text/javascript"></script>
<script src="<c:url value="js/login.js"/>"
type="text/javascript"></script>
</head>
就是那段红色的代码将超连接引向了根目录,删了就ok
发表于 @ 2007年12月19日 14:48:00|评论(loading...)|编辑