<?xml version="1.0" encoding="UTF-8"?>
<!-- Bean头部 -->
<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:mvc="http://www.springframework.org/schema/mvc" xmlns:context="http://www.springframework.org/schema/context"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="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/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd">

<!-- 激活@Controller模式 -->
<mvc:annotation-driven />

<!-- 对包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 需要更改 -->
<context:component-scan base-package="com.imooc.ssh">
<context:include-filter type="annotation"
expression="org.springframework.stereotype.Controller" />
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Service" />
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Repository" />
</context:component-scan>

<mvc:resources location="/images/" mapping="/images/**" />
<mvc:resources location="/js/" mapping="/js/**" />
<mvc:resources location="/style/" mapping="/style/**" />
<mvc:resources location="/img/" mapping="/img/**" />

<bean
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"></bean>
<bean
class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
<property name="cacheSeconds" value="0"></property>
<property name="messageConverters">
<list>
<ref bean="mapping" />
</list>
</property>
<property name="webBindingInitializer" ref="webBindingInitializer">
</property>
</bean>

<bean id="mappingStringHttpMessageConverter"
class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>

<bean id="mappingJacksonHttpMessageConverter"
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<bean class="org.springframework.http.MediaType">
<constructor-arg index="0" value="application"></constructor-arg>
<constructor-arg index="1" value="json"></constructor-arg>
<constructor-arg index="2" value="UTF-8"></constructor-arg>
</bean>
</list>
</property>
</bean>

<bean id="webBindingInitializer"
class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
<property name="conversionService">
<bean
class="org.springframework.core.convert.support.DefaultConversionService"></bean>
</property>
</bean>

<bean
class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver"
id="viewResolver">
<property name="ignoreAcceptHeader" value="true" />
<property name="mediaTypes">
<map>
<entry key="json" value="application/json"></entry>
<entry key="xml" value="application/xml"></entry>
</map>
</property>
<property name="defaultContentType" value="text/html"></property>
<property name="favorParameter" value="false"></property>
<property name="viewResolvers">
<list>
<bean
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="order" value="2"></property>
<property name="prefix" value="/WEB-INF/views/"></property>
<property name="suffix" value=".jsp"></property>
</bean>

</list>
</property>

</bean>
</beans>

springmvc配置文件 spring-servlet的更多相关文章

  1. springmvc配置文件web.xml详解各方总结(转载)

    Spring分为多个文件进行分别的配置,其中在servlet-name中如果没有指定init-param属性,那么系统自动寻找的spring配置文件为[servlet-name]-servlet.xm ...

  2. 【SSM 1】SpringMVC、Spring和Struts的区别

    导读:近期做到的项目中,用到的框架师SSM(SpringMVC+Spring+Mybatis),那么在这之前用过SSH,这里主要是区分一下SpringMVC和Struts,但是由于SpringMVC和 ...

  3. SpringMVC,Spring,Hibernate,Mybatis架构开发搭建之SpringMVC部分

    SpringMVC,Spring,Hibernate,Mybatis架构开发搭建之SpringMVC部分 辞职待业青年就是有很多时间来写博客,以前在传统行业技术强度相对不大,不处理大数据,也不弄高并发 ...

  4. SpringMVC(2)—SpringMVC整合Spring的HelloWorld

    一.这是一个SpringMVC框架的案例HelloWorld 功能:HelloWorld 二.SpringMVC运行流程 1.流程 请求-->springDispatcherServlet的ur ...

  5. springmvc配置文件web.xml详解各方总结。

    Spring分为多个文件进行分别的配置,其中在servlet-name中如果没有指定init-param属性,那么系统自动寻找的spring配置文件为[servlet-name]-servlet.xm ...

  6. SpringMVC配置文件 中 mvcview-controller 标签的使用

    一.<mvc:view-controller path=""/>标签的作用 工程WEB-INF目录下面的JSP页面,我们知道是不能直接使用URL访问到.需要通过控制器转 ...

  7. SpringMVC、Spring和Struts的区别

    http://www.cnblogs.com/hhx626/p/6010293.html 导读:近期做到的项目中,用到的框架师SSM(SpringMVC+Spring+Mybatis),那么在这之前用 ...

  8. SpringMVC配置文件-web.xml的配置

    SpringMVC配置文件(重点) @Web.xml @核心拦截器(必配) <!-- spring 核心转发器,拦截指定目录下的请求,分配到配置的拦截路径下处理 --> <servl ...

  9. 新建springmvc配置文件

    新建spring或springmvc的配置文件时,需要先加入spring-bean-4.3.18.RELEASE.jar包,当然可以是其他版本,这样就可以在资源目录下,比如resources(Reso ...

  10. 【串线篇】概述SpringMvc和spring整合

    SpringMVC和Spring整合的目的:分工明确: SpringMVC的配置文件就来配置和网站转发逻辑以及网站功能有关的(视图解析器,文件上传解析器,支持ajax,xxx):springmvc.x ...

随机推荐

  1. (转载)Convolutional Neural Networks卷积神经网络

    Convolutional Neural Networks卷积神经网络 Contents 一:前导 Back Propagation反向传播算法 网络结构 学习算法 二:Convolutional N ...

  2. GemFire

    一.GemFire是什么?   如果你了解Redis或memCached,那么恭喜,你很快就能理解GemFire是什么,没错,你可以把它理解为一个增强版的Redis,具体在哪些方面增强,我们日后慢慢聊 ...

  3. 【UVA10829】 L-Gap Substrings (后缀数组)

    Description If a string is in the form UVU, where U is not empty, and V has exactly L characters, we ...

  4. wcf托管在IIS上,提示未能加载

    “/”应用程序中的服务器错误. 未能加载文件或程序集“ZBMYunCoreLib.DLL”或它的某一个依赖项.找不到指定的模块. 说明: 执行当前 Web 请求期间,出现未经处理的异常.请检查堆栈跟踪 ...

  5. java基础(七)面向对象(二)

    这里有我之前上课总结的一些知识点以及代码大部分是老师讲的笔记 个人认为是非常好的,,也是比较经典的内容,真诚的希望这些对于那些想学习的人有所帮助! 由于代码是分模块的上传非常的不便.也比较多,讲的也是 ...

  6. [JIT_APP]Android SQLite简介

    SQLite介绍 SQLite是一个非常流行的嵌入式数据库,它支持SQL语言,并且只利用很少的内存就有很好的性能.此外它还是开源的,任何人都可以使用它.许多开源项目(Mozilla, PHP, Pyt ...

  7. linux平台MongoDB数据库安装

    跟Ruiy哥一起玩转吧; <一,初始化玩转MongoDB> 1,关闭SElinux(Ruiy哥根据经验知红帽的SElinux架设就是个错误,还记得不管啥结构首先要关闭的就是它); 2,设置 ...

  8. 突破LVS瓶颈,LVS Cluster部署(OSPF + LVS) - lxcong的运维技术 - 开源中国社区

    突破LVS瓶颈,LVS Cluster部署(OSPF + LVS) - lxcong的运维技术 - 开源中国社区 突破LVS瓶颈,LVS Cluster部署(OSPF + LVS)

  9. 上海Uber优步司机奖励政策(1月25日~1月31日)

    滴快车单单2.5倍,注册地址:http://www.udache.com/ 如何注册Uber司机(全国版最新最详细注册流程)/月入2万/不用抢单:http://www.cnblogs.com/mfry ...

  10. iOS开发总结-搜索功能实现--使用SKTag

    TagsTableViewController.h 文件 #import <UIKit/UIKit.h> #import "personSearch.h" @inter ...