1. 程式人生 > >Could not find acceptable representation錯誤

Could not find acceptable representation錯誤

nta not find post rod request repr 出發 utf-8 發現

Could not find acceptable representation:“找不到可接受的形式”

發現可能出發這種異常情況的原因:

請求contenttype=application/json;charset=UTF-8,而這裏是produces=text/html

原來代碼:

@RequestMapping(value = "/getPage.action", method = RequestMethod.POST, produces = "text/html; charset=UTF-8")

解決方法:去掉produces = "text/html; charset=UTF-8"這段代碼或者設置produces=application/json;charset=UTF-8

如果返回的信息是提示信息如“修改成功”等,則produces="text/html;charset=UTF-8",但如果返回的信息是json數據,則produces="application/json;charset=UTF-8"




Could not find acceptable representation錯誤