Spring4 MVC json问题(406 Not Acceptable)
最近使用spring4.0的Mvc,json请求时,客户端报错,406 Not Acceptable
解决方法:
1、导入第三方的fastjson包,fastjson-1.1.34.jar
2、Spring配置文件添加:
<mvc:annotation-driven>
<mvc:message-converters register-defaults="true">
<!-- 避免IE执行AJAX时,返回JSON出现下载文件 -->
<bean id="fastJsonHttpMessageConverter" class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>application/json;charset=UTF-8</value>
</list>
</property>
</bean>
</mvc:message-converters>
</mvc:annotation-driven>
Spring4 MVC json问题(406 Not Acceptable)的更多相关文章
- springMvc中406错误解决,springMvc使用json出现406 (Not Acceptable)
springMvc中406错误解决, springMvc使用json出现406 (Not Acceptable) >>>>>>>>>>> ...
- Spring MVC 3.2 406 Not Acceptable
Spring MVC 3.2 406 Not Acceptable 这个报错主要是因为SpringMVC配置文件配置问题. 修改步骤如下: 首先,修改spring-mvc.xsd为 spring-mv ...
- Spring WebMVC 4.1返回json时 406(Not Acceptable)
1.问题现象Tomcat7+Spring4.1.4,返回json字符串时发生406错误 The resource identified by this request is only capable ...
- Spring MVC 的json问题(406 Not Acceptable)
原因 : 就是程序转换JSON失败. 在pom.xml 加上 <dependency> <groupId>com.fasterxml.jackson.core</grou ...
- Spring MVC Rest服务 返回json报406错误的解决办法
@ResponseBody & @RequestBody @RequestBody 将 HTTP 请求正文插入方法中,使用适合的HttpMessageConverter将请求体写入某个对象. ...
- Spring MVC 4.1.4 RESTFUL风格返回JSON数据406错误处理
Spring MVC 4.1.4 RESTFUL风格返回JSON数据406错误处理 今天在使用spring4.1.4,使用ResponseBody注解返回JSON格式的数据的时候遇到406错误. 解决 ...
- Spring MVC控制器用@ResponseBody声明返回json数据报406的问题
本打算今天早点下班,结果下午测试调试程序发现一个问题纠结到晚上才解决,现在写一篇博客来总结下. 是这样的,本人在Spring mvc控制层用到了@ResponseBody标注,以便返回的数据为json ...
- Spring MVC 以.html为后缀名访问获取数据,报406 Not Acceptable错误。
如题,最近以spring mvc作为后台框架,前端异步获取数据时(.html为后缀名的访问方式),报406 Not Acceptable错误.当初都不知道啥原因,前后台都没报错就是返回不了数据,于是查 ...
- Spring MVC 以.html为后缀名访问获取数据,报406 Not Acceptable错误
转载,感谢这位博主,有自己的添加. 如题,最近以spring mvc作为后台框架,前端异步获取数据时(.html为后缀名的访问方式),报406 Not Acceptable错误.当初都不知道啥原因,前 ...
随机推荐
- python-day37(正式学习)
前景回顾 抢票系统的代码优化,使用了Lock类 from multiprocessing import Process,Lock import os,time,json with open('user ...
- python网络编程-socket套接字通信循环-粘包问题-struct模块-02
前置知识 不同计算机程序之间数据的传输 应用程序中的数据都是从程序所在计算机内存中读取的. 内存中的数据是从硬盘读取或者网络传输过来的 不同计算机程序数据传输需要经过七层协议物理连接介质才能到达目标程 ...
- 配置Mysql远程连接
一.赋予某个用户权限 1.赋予权限格式:grant 权限 on 数据库对象 to 用户@IP(或者相应正则) 注:可以赋予select,delete,update,insert,index等权限精确到 ...
- 剑指offer-扑克牌顺子-知识迁移能力-python
题目描述 LL今天心情特别好,因为他去买了一副扑克牌,发现里面居然有2个大王,2个小王(一副牌原本是54张^_^)...他随机从中抽出了5张牌,想测测自己的手气,看看能不能抽到顺子,如果抽到的话,他决 ...
- sql--inner join , out join
inner join(又叫join) out join包括left join,right join和full join(也就是left+right)
- 无障碍开发(三)之ARIA aria-***属性值
aria-***属性值
- wex5 页面跳转
页面交互: 3种方法: 1.使用Shell提供的方法 打开另一个页面不需要等待页面返回 功能树上打开 2. 用windowDialog组件 需要等待页面返回 3.内嵌页 windowContainer ...
- yii自定义验证
自定义验证类 class BaseModel extends Model { public function rules() { return [ ['obj', ContentSecurityVal ...
- Gcc 安装过程中部分配置
Gcc 安装过程中部分配置详解 全文参考<have fun with Gcc>一文,如有需要请联系原作者prolj@163.com 解压gcc源码后,需要进行configure,这时候一般 ...
- Vue基础组件
本文章仅用作于个人学习笔记(蓝后我就可以乱写啦)复制代码 一.组件化的优点当TodoList的todo item越来越多的时候,我们应该把它拆分成一个组件进行开发,维护.组件的出现,就是为了拆分Vue ...