title: Timestamp Spring conversion
body: <p>I'm trying to work with timestamp. I've defined in the jsp a hidden var from a bean.</p>
  
  <pre><code>&lt;form:input type="hidden" path="timeStamp" /&gt;
  
  private Timestamp timeStamp;
  
  public final Timestamp getTimeStamp() {
  return (timeStamp == null)
  ? null : (Timestamp) timeStamp.clone();
  }
  
  public final void setTimeStamp(Timestamp timeStamp) {
  this.timeStamp = (timeStamp == null)
  ? null : (Timestamp) timeStamp.clone();
  }
  </code></pre>
  
  <p>The Timestamp is generated in the insert operation, and I need it for the delete op. My problem is, that in the controller, once I'm trying to delete the record recently inserted, this timeStamp is null (but it isn't null in the jsp)</p>
  
  <pre><code>public final void doActionDelete(DumyBean bean, Errors errors, ActionRequest actionrequest...)
  </code></pre>
  
  <p>bean.timeStamp is equal to null?? I'm sure that the timestamp is in the jsp, so I guess the problem is about data conversion.</p>
  
  <p>(Edited:) I think that the problem is the initBinder method, where I'm doing something like this...</p>
  
  <pre><code>@InitBinder
  public final void initBinder(WebDataBinder binder) {
  
      SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
      dateFormat.setLenient(false);
  
      binder.registerCustomEditor(Date.class, new CustomDateEditor(dateFormat, true));
  }
  </code></pre>
  
  <p>Is it possible that, the date is parsed to be shown in the JSP with the "dd/MM/yyyy" format, and after that spring doesn't know how to transform it again into timeStamp??</p>
  
  <p>In the doAction method, the errors var show this error, that seems the problem is where I said, but I've no idea how to fix it.</p>
  
  <pre><code>"Failed to convert property value of type 'java.lang.String' to required type 'java.sql.Timestamp' for property 'timeStamp'; 
  nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [java.lang.String] to required type
  [java.sql.Timestamp] for property 'timeStamp': PropertyEditor [org.springframework.beans.propertyeditors.CustomDateEditor] 
  returned inappropriate value of type [java.util.Date]
  </code></pre>