Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody XXX

问题描述

前端使用ajax发送post请求发送Json数据,spring mvc报Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported for @RequestBody  XXX错误

 解决办法

1.重新组装数据
var params=JSON.stringify({param1:param1});

2.ajax请求设置
dataType: "json",
data: param,
contentType: "application/json;charset-UTF-8"

  

posted @ 2018-08-25 15:21  mu_fire  阅读(28432)  评论(0编辑  收藏  举报