SpringMVC基本配置

<?xml version="1.0" encoding="UTF-8"?>
<!-- SpringMVC配置文件 -->
<beans 
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:mvc="http://www.springframework.org/schema/mvc" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans     
                        http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
                        http://www.springframework.org/schema/context 
                        http://www.springframework.org/schema/context/spring-context-3.2.xsd
                        http://www.springframework.org/schema/mvc
                        http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd">
    
    <!-- SpringMVC注解扫描 -->
    <context:component-scan base-package="com.system.controller"></context:component-scan>
    
    <!-- 避免IE执行AJAX时,返回JSON出现下载文件 --> 
    <bean id="mappingJacksonHttpMessageConverter" class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter"> 
        <property name="supportedMediaTypes"> 
            <list> 
                <value>text/html;charset=UTF-8</value> 
            </list> 
        </property> 
    </bean> 
    
    <mvc:annotation-driven/>
    
    <!-- SpringMVC视图解析 -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/JSP/"/>
        <property name="suffix" value=".jsp"/>
    </bean>
    
</beans>

 

SpringMVC基本配置,布布扣,bubuko.com

SpringMVC基本配置

上一篇:java中泛型上限,下限应用


下一篇:Java编程思想笔记(第二章)