springmvc.xml-配置
<?xml version="1.0" encoding="UTF-8"?>
<beans (>:本括号删除即可,因为网址放在beans标签中不显示) xmlns=“http://www.springframework.org/schema/beans”
xmlns:xsi=“http://www.w3.org/2001/XMLSchema-instance” xmlns:p=“http://www.springframework.org/schema/p”
xmlns:context=“http://www.springframework.org/schema/context”
xmlns:mvc=“http://www.springframework.org/schema/mvc”
xsi:schemaLocation=“http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.2.xsd
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.2.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd” >
<!-- 注解驱动 -->
<!-- 开启驱动 -->
<mvc:annotation-driven/>
<!-- 开启扫描 -->
<context:component-scan base-package="com.lizx.*"></context:component-scan>
<!-- 视图解析器 -->
<!-- 配置视图解析器 -->
<!-- 配置视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!-- 找web-inf文件下的pages文件下的以.jsp结尾的文件 -->
<property name="prefix" value="/WEB-INF/pages/"/>
<property name="suffix" value=".jsp"/>
</bean>
<!-- 配置拦截器 -->
<mvc:interceptors>
<mvc:interceptor>
<!-- 拦截所有请求 -->
<mvc:mapping path="/**"/>
<!-- 导入自定义的类 -->
<bean class="com.lizx.util.SpringMvcIntercepter"></bean>
</mvc:interceptor>
</mvc:interceptors>
</beans>