validation - Unable to validate for date in Spring MVC -
i using custom editors converting string date. code mentioned below
@initbinder public void initbinder(webdatabinder binder) { simpledateformat dateformat = new simpledateformat("yyyy-mm-dd"); dateformat.setlenient(false); binder.registercustomeditor(date.class, new customdateeditor(dateformat, false)); }
when entering date in "yyyy-mm-dd" inserting.
but when entering blank throws exception
nested exception java.lang.illegalargumentexception: not parse date: unparseable date: " "
i unable validate same.
if give other format not able parse.
when instantiate customdateeditor, second parameter, in case, should true. true allows empty values.
Comments
Post a Comment