springMVC报出400,The request sent by the client was syntactically incorrect.

前台提交form,tomcat返回 http status 400   The request sent by the client was syntactically incorrect,控制台无任何错误输出。

      这是因为前台form表单中的某些参数 和 后台接受的参数类型不一致导致的。即参数名称相同,但是类型不一致。spring mvc在绑定参数的时候出现异常,所以返回400错误。但是坑爹的地方在于,这个异常会被spring mvc吃掉,不会显示在控制台中。

      解决办法:检查form表单中的参数和后台的参数对应,看是否有参数名相同但是类型不一致的情况。或者把当前日志设为debug 级别,然后在日志中即可看到spring 抛出的异常信息,即可发现哪个参数出现了错误。

引用:https://my.oschina.net/building/blog/137824

猜你喜欢

转载自blog.csdn.net/qq594913801/article/details/78769371