Field error in object 'xxx' on field 'XXX': rejected value [];

SSM中,前端搜索条件为空时,value为“”,传值时无法转换为int,会导致加载controller之前就报错,故应把属性值得类型改为Integer,即可接收到null

 

Field error in object 'xxx' on field 'XXX': rejected value [];

codes [typeMismatch.XXX.xxx,typeMismatch.xxx,typeMismatch.int,typeMismatch]; 

arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [XXX.xxx,xxx]; arguments []; 

default message [xxx]]; 

default message [Failed to convert property value of type 'java.lang.String' to required type 'int' for property 'xxx'; nested exception is java.lang.NumberFormatException:

For input string: ""]

posted @ 2020-08-06 20:36  傲娇的白狐  阅读(11851)  评论(1)    收藏  举报