錯誤描述
前台頁面采用spring mvc的form表單進行提交請求,結果頁面出現如下錯誤:
HTTP Status 400 – Bad Request Type Status Report Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
大致意思是:畸形的請求語法,無效的請求消息幀,欺騙的請求路由
異常原因
400錯誤信息中包含了錯誤原因的提示The server cannot or will not process the request due to something that is perceived to be a client\color{red}clientclient error
根據異常提示:一般都是請求有問題(不是server的問題,是程序錯誤)
發出請求的頁面
處理請求的controller
pojo定義
前台form表單中的部分參數 和 后台接受的參數類型不一致導致的。即參數名稱相同,但是類型不同(比如前天是一般input返回的是String類型,但是后台的屬性是int的時候就會除此錯誤
又比如前台是String類型,后台是一個自定義對象類型的時候會出現此問題)。spring mvc在綁定參數的時候出現異常,導致server返回400錯誤
解決方法
檢查 頁面form表單字段與po中屬性的名字和類型是否一致
轉自:https://blog.csdn.net/write6/article/details/91874691