Spring MVC 通过@ResponseBody标签返回JSON数据 报406错误的解决方法

来源:互联网 发布:js xml createelement 编辑:程序博客网 时间:2024/05/16 08:55

通过@ResponseBody标签返回JSON数据的方法都报406错:

解决方法:

@RequestMapping(value = "/user/updatepwd", method = { RequestMethod.POST }, produces = "text/plain;charset=utf-8")

将produces 的值改为application/json;charset=utf-8


如:

@RequestMapping(value = "/user/lostpwd", method = { RequestMethod.POST }, produces = "application/json;charset=utf-8")


参考:http://digdata.me/archives/96/

原创粉丝点击