[英]Unable to load js in spring mvc
Unable to load js 无法加载js
JSP file JSP文件
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
...
<spring:url value="/resources/home.js" var="homeJS" />
<script src="${homeJS}"></script>
web.xml web.xml
<servlet-mapping>
<servlet-name>employee</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
spring-servlet.xml spring-servlet.xml
<mvc:resources mapping="/resources/**" location="/resources" />
<mvc:annotation-driven />
I am getting HTTP Status 404 The url that it is trying to access is http://localhost:8080/Test/resources/home.js 我正在获取HTTP状态404尝试访问的URL是http:// localhost:8080 / Test / resources / home.js
The problem was web.xml. 问题是web.xml。 Modified it to : 修改为:
<servlet-mapping>
<servlet-name>employee</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
Now working fine 现在工作正常
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.