Controller层,使用 @RequestBody接收实体 报错:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
传参数,后台@RequestBody接收实体,报错:Content type 'application/x-www-form-urlencoded;charset=UTF-8' not supported
解决方案:添加红字处的内容,既可以解决问题
$.ajax({
type : "post",
url : submiturl,
data : JSON.stringify(formData),
contentType:"application/json",
dataType : "json",
success : function(data) {
if(data.status){
$.messager.alert("系统提示","提交成功!");
$('#addDialog').dialog('close');
doSearch();
}else{
$.messager.alert("系统提示","提交失败!","error");
}
}
});