springMVC笔记:@ResponseBody
使用@ResponseBody的方式,将Map形返回值转为json,用作POST请求的返回值。为了解决406 Not Acceptable错误,需要检查以下几项:
1. 依赖包中包含jackson-mapper-asl, jackson-core-asl
2.springmvc的xml文件中包含<mvc:annotation-driven />,bean的配置为
<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"
xmlns:aop="http://www.springframework.org/schema/aop"
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/aop
http://www.springframework.org/schema/aop/spring-aop-3.0.xsd">
springMVC笔记:@ResponseBody的更多相关文章
- SpringMvc 笔记
整理出来是 SpringMvc 笔记 方便以后查询 框架太多了 不经常使用 忘记的可能性很大 自己整理一套笔记 一看就明白了 1 对比 原始请求响应流程 1 发送请求 --> 2 控制层 --& ...
- 解决SpringMVC的@ResponseBody返回中文乱码
SpringMVC的@ResponseBody返回中文乱码的原因是SpringMVC默认处理的字符集是ISO-8859-1,在Spring的org.springframework.http.conve ...
- [转]SpringMVC使用@ResponseBody时返回json的日期格式、@DatetimeFormat使用注意
一.SpringMVC使用@ResponseBody时返回json的日期格式 前提了解: @ResponseBody 返回json字符串的核心类是org.springframework.http.co ...
- SpringMVC使用@ResponseBody时返回json的日期格式、@DatetimeFormat使用注意
一.SpringMVC使用@ResponseBody时返回json的日期格式 前提了解: @ResponseBody 返回json字符串的核心类是org.springframework.http.co ...
- SpringMVC使用@ResponseBody注解返回中文字符串乱码的问题
先说一下我的经历,以及解决问题的而过程. 在使用SpringMVC的时候,最开始的时候在配置文件中使用<mvc:annotation-driven />去自动注册DefaultAnnota ...
- SpringMVC的@ResponseBody返回JSON,中文乱码问题的解决.
SpringMVC的@ResponseBody,返回json,如果有中文显示乱码的解决办法. 在SpringMVC的配置文件中 <bean class="org.springframe ...
- spring mvc 返回乱码SpringMVC使用@ResponseBody注解返回中文字符串乱码的问题
原文地址:https://www.cnblogs.com/fzj16888/p/5923232.html 先说一下我的经历,以及解决问题的而过程. 在使用SpringMVC的时候,最开始的时候在配置文 ...
- SpringMVC笔记——SSM框架搭建简单实例
落叶枫桥 博客园 首页 新随笔 联系 订阅 管理 SpringMVC笔记——SSM框架搭建简单实例 简介 Spring+SpringMVC+MyBatis框架(SSM)是比较热门的中小型企业级项目开发 ...
- SpringMvc返回@ResponseBody中文乱码
使用SpringMvc的@ResponseBody返回指定数据的类型做为http体向外输出,在浏览器里返回的内容里有中文,会出现乱码,项目的编码.tomcat编码等都已设置成utf-8,如下返回的是一 ...
- 初学者的springmvc笔记02
springmvc笔记 springmvc拦截器,spring类型转换,spring实现文件上传/下载 1.SpringMVC标准配置 导入jar包:core contaner 在web.xml文件中 ...
随机推荐
- USACO Section1.3 Prime Cryptarithm 解题报告
crypt1解题报告 —— icedream61 博客园(转载请注明出处)--------------------------------------------------------------- ...
- js实现类bootstrap模态框动画
在pc端开发,模态框是一个很常用的插件,之前一直用的第三方插件,比如bootstrap,jQuery的模态框插件,最近还用了elementUI的.但是会发现其实动画效果都差不多,那么如何去实现这样一个 ...
- Java 遍历Map集合的方法
方法一:通过Map.keySet,遍历key和value Map<String, Object> map = new HashMap<>(); for (String key ...
- python代码简写(推导式 if else for in)
c = a if a>b else b //如果a>b返回a,否则返回b >>> a = 1 >>> b = 2 >>> c = ...
- Cookies 、 Session 和 token 的区别
这篇文章写的 Cookies 和 Session的区别 比较详细,也很好理解,可以学习下:https://blog.csdn.net/axin66ok/article/details/6175522 ...
- unity灯光Lightmapping、LightProbes
1.为什么要用Lightmapping? 简单来说就是实时灯光计算十分耗时,随着光源越多,计算耗时会倍增.使用Lightmap模拟灯光带来的效果,便不用去计算灯光,会带来性能上的大大提升. 当然一个复 ...
- shell之iptables
这五个位置也被称为五个钩子函数(hook functions),也叫五个规则链. 1.PREROUTING (路由前) 2.INPUT (数据包流入口) 3.FORWARD (转发管卡) 4.OUTP ...
- 爬虫:Scrapy8 - Item Pipeline
当 Item 在 Spider 中被收集之后,它将会被传递到 Item Pipeline,一些组件会按照一定的顺序执行对 Item 的处理. 每个 item pipeline 组件(有时也称之为“It ...
- Hibernate 查询方法
1.简单查询: public User select(User user) { User newUser; try { newUser = (User) session.get(User.class, ...
- reinterpret_cast and const_cast
reinterpret_cast reinterpret意为“重新解释” reinterpret_cast是C++中与C风格类型转换最接近的类型转换运算符.它让程序员能够将一种对象类型转换为另一种,不 ...