前後端資料型別不一致的情況
阿新 • • 發佈:2019-01-02
1 前端傳過來的資料,和後端不一致時,會出現如下問題
Failed to bind request element: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.lang.Integer]; nested exception is java.lang.NumberFormatException: For input string: "admin" [nio-8089-exec-5] .w.s.m.s.DefaultHandlerExceptionResolver : Resolved exception caused by Handler execution: org.springframework.web.method.annotation.MethodArgumentTypeMismatchException: Failed to convert value of type [java.lang.String] to required type [java.lang.Integer]; nested exception is java.lang.NumberFormatException: For input string: "admin"
解決辦法,就是使前後端資料型別一直就可以了。
還有一種就是轉換
連線如下