title: Spring MVC form validation Date field
body: <p>I have a form field that should be converted to a Date object, as follows:</p>
  
  <pre><code>&lt;form:input path="date" /&gt;
  </code></pre>
  
  <p>And I have requirement to make validation in following way:</p>
  
  <ol>
  <li><p>If user leaves this field es empty. I need to set some default date.</p></li>
  <li><p>If User enetered in unacceptable format, I need to present an error.</p></li>
  </ol>
  
  <p>The problem is that I can meet either 1st or 2nd requirement.</p>
  
  <ol>
  <li>I can register <strong>PropertyEditor</strong> and in case date is unacceptable set null, and in case this field null set some default date. But with this approach I can't meet 2nd requirement because if I convert it to null I won't have ability to register 2nd error to user.</li>
  <li>I can set  <strong>@DateTimeFormat(pattern="dd-MMM-yyyy")</strong>  annotation and provide appropriate typeMismatch error but it still return this error when user leaves empty value in this field.</li>
  </ol>
  
  <p>Is any good solution to such problem ?</p>