虽然我要包含js文件,但它工作不正常
<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 :(得分:0)
它只是在黑暗中拍摄但你也尝试过:
<script type="text/javascript" src="/js/bootstrap.js"></script>