码迷,mamicode.com
首页 > 编程语言 > 详细

SpringMVC.xml配置文件

时间:2017-05-28 19:39:56      阅读:138      评论:0      收藏:0      [点我收藏+]

标签:页面   div   jsp   文件   cat   ssi   ima   ack   and   

<?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>

 

SpringMVC.xml配置文件

标签:页面   div   jsp   文件   cat   ssi   ima   ack   and   

原文地址:http://www.cnblogs.com/EzioSyh/p/6916374.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!