2017-10-18 92 views
0

,而我特林喲包括js文件它不工作的罰款資源內根的Java動態網頁不加載,JS的CSS

<script type="text/javascript" src="js/bootstrap.js"></script> 

我也試過

<script type="text/javascript" src="${pageContext.request.contextPath}/js/jquery-3.1.1.min.js"></script> 

you can check the project structure as below pic

而且我已經自定義了我的視圖解析器,它會影響資源的路徑!

公共類JstlView擴展InternalResourceView {

@Override 
protected void renderMergedOutputModel(Map<String, Object> model, HttpServletRequest request, HttpServletResponse response) throws Exception { 

// Expose the model object as request attributes. 
exposeModelAsRequestAttributes(model,request); 

// Determine the path for the request dispatcher. 
String dispatcherPath = prepareForRendering(request, response); 

// set original view being asked for as a request parameter 
request.setAttribute("partial", dispatcherPath.substring(dispatcherPath.indexOf("Tasker/",1) + 1)); 

// force everything to be template.jsp 
RequestDispatcher requestDispatcher = request.getRequestDispatcher("/WEB-INF/jsp/template.jsp"); 
requestDispatcher.include(request, response); 

} 

非常感謝..

回答

0

這只是瞎猜,但你嘗試也:

<script type="text/javascript" src="/js/bootstrap.js"></script> 
+0

我有同樣的結果嘗試,請檢查後更新 – user3310912

+0

好的,那麼你可以檢查你的.war文件,你有這個js文件夾嗎?它應該是這樣的結構:https://imgur.com/OA3g0mr – Pooky

+0

是的沒錯,https://imgur.com/a/4RvW7 – user3310912