【Spring】mvc:annotation-driven 使用
关注此标签,是在项目中有使用
- <!-- 解决@ResponseBody 的实现类其默认的编码是 iso-8859-1的问题 -->
- <mvc:annotation-driven>
- <mvc:message-converters>
- <!-- default StringHttpMessageConverter, solve encoding problem -->
- <bean class="org.springframework.http.converter.StringHttpMessageConverter">
- <constructor-arg value="UTF-8" />
- <property name="writeAcceptCharset" value="false" />
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
- <mvc:annotation-driven>
- <mvc:message-converters>
- <bean class="org.springframework.http.converter.StringHttpMessageConverter">
- <property name="supportedMediaTypes">
- <list>
- <value>text/plain;charset=UTF-8</value>
- </list>
- </property>
- </bean>
- </mvc:message-converters>
- </mvc:annotation-driven>
平常一般的使用就是直接配置:
- <mvc:annotation-driven />
类型转换服务实例默认为org.springframework.format.support.FormattingConversionServiceFactoryBean。
可以覆盖conversion-service属性来指定类型转换服务实例类。
可以使用setting明确的配置
【Spring】mvc:annotation-driven 使用的更多相关文章
- [Spring MVC] - Annotation验证
使用Spring MVC的Annotation验证可以直接对view model的简单数据验证,注意,这里是简单的,如果model的数据验证需要有一些比较复杂的业务逻辑性在里头,只是使用annotat ...
- spring3 jsp页面使用<form:form modelAttribute="xxxx" action="xxxx">报错,附连接数据库的spring MVC annotation 案例
在写一个使用spring3 的form标签的例子时,一直报错,错误信息为:java.lang.IllegalStateException: Neither BindingResult nor plai ...
- Spring MVC @RequestMapping Annotation Example with Controller, Methods, Headers, Params, @RequestParam, @PathVariable--转载
原文地址: @RequestMapping is one of the most widely used Spring MVC annotation.org.springframework.web.b ...
- [转] Spring MVC sample application for downloading files
http://www.codejava.net/frameworks/spring/spring-mvc-sample-application-for-downloading-files n this ...
- Spring MVC文件上传教程
1- 介绍 这篇教程文章是基于 Spring MVC来实现文件的上传功能,这里主要是实现两个功能:1.上传单个文件并将其移动到对应的上传目录:2.一次上传多个文件并将它们存储在指定文件夹下,接下来我们 ...
- Spring MVC配置静态资源和资源包教程
1- 介绍 这篇教程文章是基于: Spring 4 MVC 2- 创建一个项目 File/New/Other.. 输入: Group ID: com.yiibai Artifact ID: Sprin ...
- SSM(spring mvc+spring+mybatis)学习路径——2-1、spring MVC入门
目录 2-1 Spring MVC起步 一.回顾Servlet 二.SpringMVC简介 三.搭建SpringMVC第一个案例 四.简单流程及配置 五.使用注解开发Controller 六.参数绑定 ...
- Spring MVC 学习笔记3 - 利用Default Annotation 模式获取请求,使Controller与View对应,并传值。
1. WEB-INF/web.xml 这里定义了获取请求后,执行的第一步.抓取请求. <servlet> <servlet-name>appServlet</servle ...
- spring,spring mvc之所以起作用是因为开启了注解解释器,即spring的annotation on
spring,spring mvc之所以起作用是因为开启了注解解释器,即spring的annotation on
- springboot Serving Web Content with Spring MVC
Serving Web Content with Spring MVC This guide walks you through the process of creating a "hel ...
随机推荐
- js多语言切换demo
网站为了国际化的需要,会使用到语言包,案例如下图. 这次尝试用js来打语言包,用到了插件 jquery.i18n.properties ,很明显,使用这个插件需要先加载jquery. 代码布局结构 ...
- nginx 配置反向代理根目录到其他服务器
location /detail/json { if ( $uri = "/detail/json" ) { rewrite "/detail/json" /i ...
- python之时间日期time
常用的时间函数如下获取当前日期:time.time()获取元组形式的时间戳:time.local(time.time())格式化日期的函数(基于元组的形式进行格式化):time.asctime(tim ...
- Java学习笔记【八、数据结构】
参考资料: http://www.cnblogs.com/janneystory/p/5758958.html array arraylist list linklist的区别 http://www. ...
- java_day09_GUI事件
第九章:GUI事件 1.AWT事件模型概述 使用AWT或者Swing中的容器.组件和布局管理器就可以构建出图形界面,但是这时候该界面还并不能和用户进行交换,因为图形界面中的组件还没有添加事件监听器,所 ...
- Jmeter (一) 安装
https://blog.csdn.net/ls1792304830/article/details/52718177 一.准备工具 1.Windows 操作系统 2.jmeter 3.JDk 依赖环 ...
- Selenium3-浏览器与驱动对照
在学selenium自动化测试时,遇到的第一个大问题便是浏览器版本.浏览器驱动版本与selenium的版本不对应,而无法驱动浏览器进行自动化操作. 收集了网上的一些技术文档,决定也整理一份相对较全面的 ...
- git fetch和pull的区别
Git中从远程的分支获取最新的版本到本地有这样2个命令: 1. git fetch:相当于是从远程获取最新版本到本地,不会自动merge 1 2 3 Git fetch origin master ...
- [易学易懂系列|rustlang语言|零基础|快速入门|(22)|宏Macro]
[易学易懂系列|rustlang语言|零基础|快速入门|(22)|宏Macro] 实用知识 宏Macro 我们今天来讲讲Rust中强大的宏Macro. Rust的宏macro是实现元编程的强大工具. ...
- C#:调用存储过程方法
MySqlParameter p1 = new MySqlParameter("id", MySqlDbType.Int32); p1.Value = sid; MySqlPara ...