jsp中引入js、css時出現net::ERR_ABORTED 404 (Not Found)錯誤
阿新 • • 發佈:2021-02-06
技術標籤:畢設遇到的問題
如圖:
解決方法:
加入以下程式碼到你的jsp頁面中
加在頭部
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%=basePath%>
加在你引用的<link>
tag中
如:
<link href="<%=basePath%>/css/sign-in.css?v=<%= System.currentTimeMillis()%>" rel="stylesheet">
問題解決!