【发布时间】:2013-08-16 11:24:56
【问题描述】:
我想知道我是否可以在 Hibernate Validator 中使用关于日期格式错误的个人错误消息进行格式化。
我的类属性看起来像这样。
@DateTimeFormat(pattern = "hh:mm")
private Date hourOpen;
表单中的默认错误和消息:错误弹簧标签。
Failed to convert property value of type java.lang.String to required type java.util.Date for property hourOpen; nested exception is org.springframework.core.convert.ConversionFailedException: Failed to convert from type java.lang.String to type @org.springframework.format.annotation.DateTimeFormat java.util.Date for value 11; nested exception is java.lang.IllegalArgumentException: Unable to parse 11
我想在 form:error spring 标记中显示“日期格式错误”消息。
提前谢谢你。
【问题讨论】:
标签: hibernate message validation