SpringMvc 参数是对象,包含不提交基本类型的时候 400错误

来源:互联网 发布:热设计软件 编辑:程序博客网 时间:2024/05/01 08:21
Field error in object 'pojectInfo' on field 'staffCount': rejected value []; codes [typeMismatch.pojectInfo.staffCount,typeMismatch.staffCount,typeMismatch.int,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [pojectInfo.staffCount,staffCount]; arguments []; default message [staffCount]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'staffCount'; nested exception is java.lang.NumberFormatException: For input string: ""]

把基本类型改为 对象
如 int–》Integer

0 0
原创粉丝点击