springmvc 时间类型参数接收
2014-10-11 00:00
393 查看
摘要: springmvc 时间类型参数接收
{"success":false,"msg":"org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors\nField error in object 'vip' on field 'vip_regtime': rejected value [2014-10-11]; codes [typeMismatch.vip.vip_regtime,typeMismatch.vip_regtime,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [vip.vip_regtime,vip_regtime]; arguments []; default message [vip_regtime]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'vip_regtime'; nested exception is java.lang.IllegalArgumentException: Could not parse date: Unparseable date: \"2014-10-11\"]"}
以上异常内容
{"success":false,"msg":"org.springframework.validation.BindException: org.springframework.validation.BeanPropertyBindingResult: 1 errors\nField error in object 'vip' on field 'vip_regtime': rejected value [2014-10-11]; codes [typeMismatch.vip.vip_regtime,typeMismatch.vip_regtime,typeMismatch.java.util.Date,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [vip.vip_regtime,vip_regtime]; arguments []; default message [vip_regtime]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date' for property 'vip_regtime'; nested exception is java.lang.IllegalArgumentException: Could not parse date: Unparseable date: \"2014-10-11\"]"}
以上异常内容
/** * 时间转换器 */ @InitBinder public void initBinder(WebDataBinder binder) { DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd"); fmt.setLenient(false); CustomDateEditor dateEditor = new CustomDateEditor(fmt, true); binder.registerCustomEditor(Date.class, dateEditor); }
相关文章推荐
- 提高生产力:SpringMVC中,使用扩展数据类型TypedMap接收Web请求参数
- springmvc接口接收json类型参数设置
- SpringMvc控制器接收数组类型参数Demo
- SpringMVC第五篇——接收页面参数(基础类型)
- 提高生产力:SpringMVC中,使用扩展数据类型TypedMap接收Web请求参数
- SpringMVC 参数绑定获取的CST时间(Java.util.Date)类型问题
- springmvc接收date类型参数
- springMVC接收日期类型参数的自定义转换
- 02基于注解开发SpringMVC项目(jar包,异步,request,参数传递,多选的接收,Model传参,map传参,model传参,ajax,重定向,时间日期转换)
- SpringMVC接收pojo里面包含时间类型的统一处理
- SpringMVC 接收时间类型
- springMVC怎么接收日期类型的参数?
- 提高生产力:SpringMVC中,使用扩展数据类型TypedMap接收Web请求参数
- @requestbody接收json参数 映射到 实体类中 Date(时间日期)类型转换问题
- SpringMVC接收日期类型参数的自定义转换
- springmvc中@requestbody注解接收前端参数使用content-type类型
- SpringMVC无法接收日期类型的参数
- SpringMVC如何接收application/json内容编码类型的参数?
- 提高生产力:SpringMVC中,使用扩展数据类型TypedMap接收Web请求参数
- SpringMVC使用@PathVariable ,参数接收使用基本类型