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

【Content type ' application/x-www-form-urlencoded; charset=UTF-8' not supported for @RequestBod】著论准过秦,作赋拟子虚。这篇文章主要讲述Content type ' application/x-www-form-urlencoded; charset=UTF-8' not supported for @RequestBod相关的知识,希望能为你提供帮助。
问题描述

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

  解决办法
1.重新组装数据 var params=JSON.stringify({param1:param1}); 2.ajax请求设置 dataType: "json", data: param, contentType: "application/json; charset-UTF-8"



    推荐阅读