今天在做网站的时候,遇到这么一个问题:在jsp页面中引入js文件时,如果在jsp页面中写入相对路径,但是通过firebug的话,路径却是将根目录去掉之后的路径,可以这么解决:
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<script type="text/javascript" src="<%=basePath%>dhtmlxscheduler/dhtmlxscheduler.js"></script>