spring接收Integer的问题

正常情况下,使用包装类型可以避免传空时报错,但JavaBean中需要不只改类型,同样要改set方法中的传参类型,否则报如下错误:

org.springframework.validation.BeanPropertyBindingResult: 1 errors
Field error in object 'zcPersonsDto' on field 'fcancel': rejected value []; 
codes[typeMismatch.zcPersonsDto.fcancel,typeMismatch.fcancel,typeMismatch.in,
typeMismatch];arguments[org.springframework.context.support.DefaultMessageSou
rceResolvable:codes [zcPersonsDto.fcancel,fcancel]; arguments []; default 
message [fcancel]];default message [Failed to convert property value of type 
'java.lang.String' to required type 'int' for property 'fcancel';nested 
exception is java.lang.NumberFormatException: For input string: ""]

你可能感兴趣的:(我的问题集)