WEB-INF文件夾下的jsp文件訪問不到WebRoot下的js文件

在jsp頁面寫

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
String s_type = (String)request.getAttribute("s_type");
%>

<head>標籤下寫

<base href="<%=basePath%>">

在<script type="text/javascript" src="<base href="<%=basePath%>">/js/jquery.js"/>


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章