Spring Roo和Spring MVC的意外日期转换失败

时间:2012-07-13 12:33:18

标签: spring-mvc spring-roo

我将Spring MVC与Spring Roo一起使用,并且我在我的一个实体中添加了一个JPA finder。我还有@RooWebScaffold和@RooWebFinder注释如下:

@RooWebScaffold(path = "plis", formBackingObject = Pli.class)
@RooWebFinder

我的一个JPA查找器使用java.util.Date,当我运行@RooWebFinder时,我系统地在控制台中获得以下异常,我被重定向到404:

2012-07-13 14:13:31,515 ["http-bio-8131"-exec-16] DEBUG org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver - Resolving exception from handler [public java.lang.String trc.suivi.controller.PliController.findPlisByIdentifiantLikeAndDateReceptionBetweenAndPaiementAndARAndNumeroARLikeAndFDVAndConteneurNumAndStatut(java.lang.String,java.util.Date,java.util.Date,java.lang.Boolean,java.lang.Boolean,java.lang.String,java.lang.Boolean,trc.suivi.domain.ConteneurNum,trc.suivi.domain.StatutPli,org.springframework.ui.Model)]: org.springframework.beans.TypeMismatchException: Failed to convert value of type 'java.lang.String' to required type 'java.util.Date'; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @org.springframework.web.bind.annotation.RequestParam @org.springframework.format.annotation.DateTimeFormat java.util.Date for value '2012-07-04'; nested exception is java.lang.IllegalArgumentException: Invalid format: "2012-07-04" is malformed at "12-07-04"

我错过了什么?

1 个答案:

答案 0 :(得分:1)

看起来您指定的日期格式不正确: 格式无效:“2012-07-04”格式错误为“12-07-04”

实体对象中字段的日期形成是什么?

可以尝试两年的约会。