首页 > 代码库 > spring-servlet.xml

spring-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: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-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd">

<!-- 扫描注解类 -->
<context:component-scan base-package="cn.bdqn.oa.controller"></context:component-scan>

<!-- 添加mvc的注解支持 -->
<mvc:annotation-driven/>

<!-- 配置spring mvc静态资源 -->
<!--mapping 映射的资源路径,也就是页面中请求的路径 -->
<!-- location 实际的资源路径 -->
<mvc:resources location="/js/" mapping="/js/*"/>
<mvc:resources location="/welcome.html" mapping="/welcome.html"/>
<!--mapping="/css2/**" 两个*可以匹配子目录,对应的css下面也要有同名子目录 -->
<mvc:resources location="/css/" mapping="/css2/**"/>
<mvc:resources location="/images/" mapping="/images/**"/>

<!-- 视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="http://www.mamicode.com/WEB-INF/page"></property>
<property name="suffix" value="http://www.mamicode.com/.jsp"></property>
</bean>


</beans>

spring-servlet.xml