[WARNING] Resolved exception caused by handler execution: org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'productVo' on field 'productTypeId': rejected value [--请éæ--]; codes [typeMismatch.productVo.productTypeId,typeMismatch.productTypeId,typeMismatch.java.lang.Integer,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [productVo.productTypeId,productTypeId]; arguments []; default message [productTypeId]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.lang.Integer' for property 'productTypeId'; nested exception is java.lang.NumberFormatException: For input string: "--请éæ--"]
不提交任何数据报错如上,通过页面参数查看:
productTypeId传递的参数为请选择,与后台的integer数据类型不匹配导致错误。
解决:给option添加value属性,增加默认值即可解决。