客户端发送的请求的转换错误在语法上是不正确的

时间:2015-09-04 10:49:16

标签: java spring

以下是用户提交请求时的错误

 04 Sep 2015 16:08:29 DEBUG [ExceptionHandlerExceptionResolver] Resolving     
 exception from handler [public org.springframework.web.servlet.ModelAndView 
 com.emp.controller.EmployeeManagement.updateEmployeeDetails(com.emp.dto.
 EmployeDetailTO)]: org.springframework.validation.BindException:   
 org.springframework.validation.BeanPropertyBindingResult: 1 errors
 Field error in object 'employeeDetailTO' on field 'joiningDate': rejected 
 value [Thu Sep 03 15:44:32 IST 2015,Thu Sep 03 15:44:32 IST 2015]; codes 
 [typeMismatch.employeeDetailTO.joiningDate,typeMismatch.joiningDate,
 typeMismatch.java.util.Date,typeMismatch]; arguments 
 [org.springframework.context.support.DefaultMessageSourceResolvable: codes
 [employeeDetailTO.joiningDate,joiningDate]; arguments []; default message  
 [joiningDate]]; default message [Failed to convert property value of type 
 'java.lang.String[]' to required type 'java.util.Date' for property 
 'joiningDate'; nested exception is org.springframework.core.convert.
 ConversionFailedException: Failed to convert from type 
 java.lang.String to type java.util.Date for value 'Thu Sep 03 15:44:32 IST 
 2015'; nested exception is java.lang.IllegalArgumentException]

将Date作为java.util.Date UI值以字符串形式发送到TO。

修复此错误的正确方法是什么?

  1. 在TO
  2. 中将日期设为字符串
  3. 在调用接受TO作为参数的方法之前,将String更改为Date?

0 个答案:

没有答案