<?xml version="1.0" encoding="UTF-8"?><!-- xml的声明格式 -->
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-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">
<!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
<!-- 通过配置AnnotationMethodHandlerAdapter类messageConverters属性来指定编码。因为@ResponseBody 的实现类发现其默认的编码是 iso-8859-1 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
<bean class = "org.springframework.http.converter.StringHttpMessageConverter">
<property name = "supportedMediaTypes">
<list>
<value>text/plain;charset=gbk</value>
</list>
</property>
</bean>
</list>
</property>
</bean>
<!-- 组件扫描,包名为控制层的包名 -->
<context:component-scan base-package="com.icss.bs.control"/>
<!-- 默认的注解映射的支持。它会自动注册DefaultAnnotationHandlerMapping与AnnotationMethodHandlerAdapter 两个bean,是spring MVC为@Controllers分发请求所必须的。-->
<!-- 数据绑定支持,@NumberFormatannotation支持,@DateTimeFormat支持,@Valid支持,读写XML的支持(JAXB),读写JSON的支持(Jackson)。 -->
<mvc:annotation-driven />
<!--ViewResolver 视图解析器,告诉你如何从控制器转到视图,转到哪种视图 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<!--prefix前缀,增加了项目的安全性-->
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/><!--suffix前缀。可为空,方便实现自已的依据扩展名来选择视图解释类的逻辑 -->
</bean>
<!-- 文件上传表单的视图解析器 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<!-- 设置文件最大为800k -->
<property name="maxUploadSize" value="800000"/>
</bean>
<!-- 异常处理 -->
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
<!-- 定义需要特殊处理的异常,用类名或完全路径名作为key,异常也页名作为值 -->
<property name="exceptionMappings">
<props>
<!-- java异常的根类为java.lang.Throwable -->
<prop key="java.lang.Throwable">error.jsp</prop>
<!-- 超过文件上传最大限度的异常 -->
<prop key="org.springframework.web.multipart.MaxUploadSizeExceededException">error/maxUploadSizeExceed.jsp</prop>
</props>
</property>
</bean>
</beans>
分享到:
相关推荐
spring-mvc.xml spring-mybatis.xml web.xml log4j.properties,项目中需要用到的配置文件。直接可用。
这是一个springmvc-config.xml文件,<?xml version="1.0" encoding="UTF-8"?> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:...
spring-mvc.xml资源下载,本xml为springmvc最纯净版xml!
config.properties:数据库配置文件 log4j.properties:mybatis日志文件 spring-mvc.xml:spring-MVC配置文件 spring-mybatis.xml:mybatis的配置文件 spring.xml
Error creating bean with name 'org.springframework.web.servlet.handler.SimpleUrlHandlerMapping#0' defined in ServletContext resource [/WEB-INF/springMVC-servlet.xml]: Initialization of bean failed;...
Maven依赖:【***.jar Maven依赖信息(可用于项目pom.xml).txt】 Gradle依赖:【***.jar Gradle依赖信息(可用于项目build.gradle).txt】 源代码下载地址:【***-sources.jar下载地址(官方地址+国内镜像地址).txt】...
spring-aop-3.0.xsd 这个下载之后可以直接放在eclipese的xml的catalog中配置,已到达eclipse可以自动提示xml的功能
springmvc-xsd-4.2.xml
Ajax-WebStore-Spring-MVC.zip,webstore是一个在spring mvc中构建的成熟的在线购物系统。它使用jsp进行视图模板化,在数据库端使用mysql。,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、...
2、spring-mvc配置文件包括两部分,一个是spring传统配置文件,在代码中为“applicationContext.xml”,主要配置代码中各种bean以及依赖关系;另外一个是spring-mvc特有的配置文件,处理跳转的代理类得(相当于...
Ajax-spring-mvc-ex.zip,SpringMVC___:__,ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json、xml和javascript。它用于创建动态网页,其中网页的小部分在不重新加载网页的情况下更改。
Auto-configured Spring REST Docs Tests with Mock MVC Auto-configured Spring REST Docs Tests with REST Assured 43.3.20. User Configuration and Slicing 43.3.21. Using Spock to Test Spring Boot ...
以下是jar包列表 activation-1.1.jar activiti-engine-5.10.jar activiti-spring-5.10.jar antlr-2.7.7.jar aopalliance-1.0.jar aopalliance.jar asm-3.1.jar aspectjrt.jar ...xml-apis-1.0.b2.jar
Ajax-Spring-MVC-CRUD-form-submit-and-ajax.zip,spring mvc crud应用程序(springmvc、hibernate 4.x、bootstrap 3.x、jquery、mysql),ajax代表异步javascript和xml。它是多种web技术的集合,包括html、css、json...