<mvc:resources location="/WEB-INF/view/static/" mapping="/static/**" />
springmvc访问静态资源使用注解的方式正确的写法如上,看到有人说需要加classpath:
<mvc:resources location="classpath:/WEB-INF/view/static/" mapping="/static/**" />
------------------------------------------以上写法亲测不可行
location为真实路径
mapping为自定义访问路径,比如前端要使用jquery-1.8.1.js,正确的写法为:
<script language="javascript" src="<c:url value="/static/js/jquery-1.8.1.js"/>"></script>
好久没用springmvc,复习下