SpringMVC前端控制器(*-servlet.xml)配置模板

<?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"
	xmlns:p="http://www.springframework.org/schema/p"
	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-4.3.xsd
		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd">


    <!-- 声明支持驱动注解 -->
	<mvc:annotation-driven></mvc:annotation-driven>
	
	<!-- 静态资源文件过滤 -->
	<mvc:resources location="资源文件路径" mapping="*"/> 


	<bean id="viewResource"
		class="org.springframework.web.servlet.view.InternalResourceViewResolver"
		p:prefix="/WEB-INF/content/" p:suffix=".jsp"></bean>

	<context:component-scan base-package="要扫描的包名 如:com.test.action">
		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
	</context:component-scan>

</beans>

猜你喜欢

转载自blog.csdn.net/user_q/article/details/82951529