title: Failed to convert property value of type 'java.lang.String' to required type 'java.util.Date'
body: <p>I am trying to implement the full calendar plugin in my webapp using Spring MVC, Java and MySql. I have been getting this error when I try to add a date using "input type = date" in my jsp: </p>
  
  <pre><code>Field error in object 'event' on field 'endDate': rejected value [2018-03-13]; 
  codes [typeMismatch.event.endDate,typeMismatch.endDate,typeMismatch.java.util.Date,typeMismatch];
  arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [event.endDate,endDate]; arguments [];
  default message [endDate]]; default message [Failed to convert property value of type 'java.lang.String' 
  to required type 'java.util.Date' for property 'endDate'; 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 '2018-03-13'; 
  nested exception is java.lang.IllegalArgumentException: Unable to parse '2018-03-13']
  </code></pre>
  
  <p>In my controller class I am using SimpleDateFormat to format my date:</p>
  
  <pre><code>@RequestMapping(value = "add", method = RequestMethod.POST)
      public String add(@ModelAttribute("event") Event event,
              HttpServletRequest request,ServletRequestDataBinder binder,
              ModelMap modelMap){
          try{
              SimpleDateFormat simpleDateFormat = new SimpleDateFormat ("dd/MM/yyyy");
              event.setStartDate(simpleDateFormat.parse(request.getParameter("startDate")));
              event.setEndDate(simpleDateFormat.parse(request.getParameter("endDate")));
  
              eventService.create(event);
              return "redirect:../event.html";
          }catch (Exception e){
              modelMap.put("event", event);
              return "event/index";
          }   
      }
  </code></pre>
  
  <p>And finally in my Jsp: </p>
  
  <pre><code>&lt;fieldset&gt;
          &lt;legend&gt;Event Information&lt;/legend&gt;
      &lt;s:form method ="post" commandName = "event"
          action="${pageContext.request.contextPath }/event/add.html"&gt;
          &lt;table&gt;
              &lt;tr&gt;
                  &lt;td&gt;Name&lt;/td&gt;
                  &lt;td&gt;&lt;s:input path = "name"/&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td valign = "top"&gt;Description&lt;/td&gt;
                  &lt;td&gt;&lt;s:textarea path = "description" cols = "20" rows = "5" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;Start Date&lt;/td&gt;
                  &lt;td&gt;&lt;input type = "date" name = "startDate" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;End Date&lt;/td&gt;
                  &lt;td&gt;&lt;input type = "date" name = "endDate" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
              &lt;tr&gt;
                  &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                  &lt;td&gt;&lt;input type = "submit" value = "Save" /&gt;&lt;/td&gt;
              &lt;/tr&gt;
          &lt;/table&gt;
      &lt;/s:form&gt;
      &lt;/fieldset&gt;
  </code></pre>
  
  <p>Here is the DAO Implementation:</p>
  
  <pre><code>@Repository("eventDAO")
  public class EventDAOImpl implements EventDAO{
  
      @Autowired
      private SessionFactory sessionFactory;
  
      @SuppressWarnings("unchecked")
      @Override
      public List&lt;EventEntity&gt; findAll() {
          List &lt;EventEntity&gt; list = null;
          Session session = null;
          Transaction transaction = null;
          try{
              session = sessionFactory.openSession();
              transaction = session .beginTransaction();
              list = session.createQuery("select e.id as id, "
                      + "e.name as title, "
                      + "DATE_FORMAT(e.startDate, '%Y-%m-%d') as start, "
                      + "DATE_FORMAT(e.endDate, '%Y-%m-%d') as end "
                      + "from Event e")
                      .setResultTransformer(
                              Transformers.aliasToBean(EventEntity.class))
                      .list();
              transaction.commit();
          }catch(Exception e){
              list = null;
              if(transaction != null){
                  transaction.rollback();
              }
          }finally{
              session.close();
          }
          return list;
      }
  </code></pre>
  
  <p>In my Entity class I have variables saved as a date so it is </p>
  
  <pre><code>private Date endDate;
  </code></pre>
  
  <p>I think the issue is with parsing of the Date but I am not sure! Any explanation of the issue would be appreciated.</p>