<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<context:component-scan base-package="com.pt"></context:component-scan>
<!--视图解析器对象-->
<bean id="internalResourceViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/pages/"></property>
<property name="suffix" value=".jsp"></property>
</bean>
<!-- 配置拦截器-->
<mvc:interceptors>
<mvc:interceptor>
<!-- 要拦截的方法-->
<mvc:mapping path="/user/*"/>
<!-- 配置拦截器对象-->
<bean id="myInterceptor" class="com.pt.interceptor.MyInterceptor"></bean>
</mvc:interceptor>
</mvc:interceptors>
<!-- 开启springmvc框架注解支持-->
<mvc:annotation-driven />
</beans>
SpringMVC:resources下面springmvc.xml文件内容
最新推荐文章于 2021-01-20 16:47:42 发布