SpringMVC报错 'application/x-www-form-urlencoded;charset=UTF-8' not supported"

今天在写前后端传送数据突然报错application/x-www-form-urlencoded;charset=UTF-8' not supported,

网上搜索了很多结果都是修改controller类里的接收代码,比如接收注解由@RequestBody改为@Requestparam等等,都没有效果

后面了解了错误的原因,是前后端的接收编码等出现了问题,于是去看前端ajax果然发现了问题。

SpringMVC报错 'application/x-www-form-urlencoded;charset=UTF-8' not supported"

首先SpringMVC报错 'application/x-www-form-urlencoded;charset=UTF-8' not supported"上传的数据要转为JSON数据,

SpringMVC报错 'application/x-www-form-urlencoded;charset=UTF-8' not supported"重要的是要在ajax中添加编码类型

加上后,错误就没有了。