SpringMVC的配置文件

来源:互联网 发布:qq旋风 知乎 编辑:程序博客网 时间:2024/05/30 04:15
SpringMVC配置文件
<?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:aop="http://www.springframework.org/schema/aop"    xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc"    xmlns:context="http://www.springframework.org/schema/context"    xmlns:mvc="http://www.springframework.org/schema/mvc"    xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd         http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"><!-- 1. 只扫描指定包中包含有Controller注解的类  -->    <context:annotation-config/>    <context:component-scan base-package="com.controller">          <context:include-filter type="annotation"           expression="org.springframework.stereotype.Controller"/>    </context:component-scan>        <!-- 2. 加载映射器和适配器  -->    <mvc:annotation-driven />        <!-- 3. 静态页面,如html,css,js,images可以访问,不要找不到静态文件报404。-->    <mvc:default-servlet-handler /><!-- 4. 配置视图解析器并且为地址添加前缀和后缀 -->    <bean        class="org.springframework.web.servlet.view.InternalResourceViewResolver">        <property name="viewClass"            value="org.springframework.web.servlet.view.JstlView" />        <property name="prefix" value="/WEB-INF/jsp/" />        <property name="suffix" value=".jsp" />    </bean></beans>

原创粉丝点击