在练习springmvc框架时,在springmvc.xml中已配置放行静态资源的前提下,js还是加载不出来,浏览器控制台报错:net::ERR_ABORTED 404,在翻阅众多博客后,更换了jq版本(3.5.1),并重启IDEA(这步一定要做!)后成功解决,附上springmvc.xml的配置
<context:component-scan base-package="cn.itcast"></context:component-scan>
<!--配置视图解析器对象-->
<bean id="internalResourceViewResolve" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<!--前端控制器,哪些静态资源不拦截:css,图片,js不拦截-->
<mvc:default-servlet-handler/>
<!--开启springmvc对于注解的支持-->
<mvc:annotation-driven></mvc:annotation-driven>