选中的这两段代码一加上就会显示404错误,是为什么呀,是spring配置错了吗?
这个是项目整合spring框架的配置,没有错,你报404的页面可能是配置使用spring拦截器拦截了。
请确认你的applicationContext.xml文件是不是在WEB-INF下如果在src下请使用
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<!-- 对Spring容器进行实例化 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>