SpringMVC4.0.3 @ResponseBody JSON 中文乱码问题
@RequestMapping(value="listUserJson.html",produces="text/html;charset=UTF-8")
@ResponseBody
public String listUserJson(int page,int rows){
TreeMap<String, Object> map = new TreeMap<>();
map.put("rows", service.listXPUser(page, rows));
map.put("total", service.listXPUserTotal());
return JSON.toJSONString(map);
}
$.ajax({
type: "post",
url: "/pay/yilian/queryPayResult.do",
dataType: "json",
contentType: "application/x-www-form-urlencoded; charset=utf-8",
data:{
rechargeCode:$("#rechargeCode").val()
},
async: false,
success: function(data){
if(data.status == 1){
//console.dir("拿到结果了,成功跳转");
}
}
}); //ajax end!
SpringMVC4.0.3 @ResponseBody JSON 中文乱码问题的更多相关文章
- 解决@ResponseBody注解返回的json中文乱码问题
1. 简介 主要解决@ResponseBody注解返回的json中文乱码问题. 2.解决方案 2.1mvc加上注解(推荐此方法) 在mvc配置文件中假如下面配置(写在 <mvc:annotati ...
- 解决springmvc使用ResponseBody注解返回json中文乱码问题
spring版本:4.2.5.RELEASE 查看“org.springframework.http.converter.StringHttpMessageConverter”源码,中有一段说明: B ...
- Springboot @ResponseBody返回中文乱码
最近我在把Spring 项目改造Springboot,遇到一个问题@ResponseBody返回中文乱码,因为response返回的content-type一直是application/json;ch ...
- 解决SpringMVC的@ResponseBody返回中文乱码
SpringMVC的@ResponseBody返回中文乱码的原因是SpringMVC默认处理的字符集是ISO-8859-1,在Spring的org.springframework.http.conve ...
- springMvc解决json中文乱码
springMvc解决json中文乱码 springMvc解决json中文乱码,springMvc中文乱码,spring中文乱码 >>>>>>>>> ...
- 解决跨操作系统平台JSON中文乱码问题
解决跨操作系统平台JSON中文乱码问题 LINUX统一使用utf-8编码,WINDOWS却不是. LINUX中间件,传输JSON给WINDOWS程序,会乱码. 解决办法: 对JSON字段是字符串类型的 ...
- SpringMVC @ResponseBody返回中文乱码
SpringMVC的@ResponseBody返回中文乱码的原因是SpringMVC默认处理的字符集是ISO-8859-1, 在Spring的org.springframework.http.conv ...
- SpringMVC 使用@ResponseBody返回json 中文乱码与返回实体类报错
有时候我们发现接收的是中文,返回却是个?.这确实是个蛋疼的问题,Spring中解析字符串的转换器默认编码居然是ISO-8859-1 /** * Implementation of {@link Htt ...
- SSM框架:解决后台传数据到前台中文乱码问题,使用@ResponseBody返回json 中文乱码
解决方法一:@RequestMapping(value="/getphone",produces = "text/plain;charset=utf-8") / ...
随机推荐
- POJ 1469 COURSES(二部图匹配)
COURSES Time Limit: 1000MS Memory ...
- Java基础相关
对老师上课内容进行总结: 1.新建一个Java项目,并命名为HelloWorld 然后再新建类,并命名为HelloWorld,注意红色画圈部分 若勾选,则新建类开头为(“//后的内容为老师所讲批注”) ...
- backtrack下whatweb的使用
whatweb是backtrack下的一款Web识别工具,位于 Applications-->BackTrack-->Information Gathing-->Web Applic ...
- JS的prototype的共享机制分析
function Super(){ } Super.prototype.aaa=[1,2,3]; Super.prototype.bbb=1; function Sub(){ Super.call(t ...
- Codeforces Round #339 Div.2 C - Peter and Snow Blower
Peter got a new snow blower as a New Year present. Of course, Peter decided to try it immediately. A ...
- Linux驱动设计—— 中断与时钟@request_irq参数详解
request_irq函数定义 /*include <linux/interrupt.h>*/ int request_irq(unsigned int irq, irq_handler_ ...
- Java——日期格式
/* * 日期对象和毫秒值之间的转换. * * 毫秒值--->日期对象: * 1.通过Date对象的构造方法new Date(timeMillis) * 2.还可以通过setTime设 ...
- springMvc源码学习之:spirngMvc获取请求参数的方法
一. 通过@PathVariabl获取路径中的参数 @RequestMapping(value="user/{id}/{name}",method=RequestMeth ...
- Questions that are independent of programming language. These questions are typically more abstract than other categories.
Questions that are independent of programming language. These questions are typically more abstract ...
- connect to tomcat with JMX
Answering my own question; turned out to be easier than i thought. Following needs to be done, for e ...