JavaScript客户端中要声明contentType:"application/json"
function updateNavigation(){
var i18ns = [];
i18ns.push({"i18nId":$("#i18nId_"+lanCode).val(),"langCode":lanCode,"navigationName":$("#navName_"+lanCode).val(),"navigationDesc":$("#navDesc_"+lanCode).val()})
var updateInfo = {
navigationId : navId,
menuType : navType,
navigationI18ns : i18ns
}
$.ajax({
url : "update",
type : "PUT",
data : JSON.stringify(updateInfo),
dataType : "json",
contentType : 'application/json',
success : function(json){
}
},
error : function(){
}
});
}
服务器端代码
@RequestMapping(value = "/update",method = RequestMethod.PUT)
@ResponseBody
public ReturnObj updateNav(@RequestBody Navigation navigation){
ReturnObj returnObj = navigationService.updateNavigation(navigation);
return returnObj;
}