@DateTimeFormat

@DateTimeFormat

Java8 features can be replace with the following date library:

  • java.util.date
  • java.util.calendar
  • joda-time

Example, if you were using @DateTimeFormat for your model class property transaction date such as:

public class Transaction implements Serializable{

	private static final long serialVersionUID = 1L;
	private String name;
	@DateTimeFormat(pattern="yyyy-MM-dd")
	private LocalDate tranxDate;
       
       // code omitted
       ....
}

this require you to enabled with mvc:annotation-driven in your application context, otherwise when your form post will get wrong without much information provided.

HTTP Status 400 -
type Status report
message
description The request sent by the client was syntactically incorrect.
Apache Tomcat/8.0.21

 

Write a Reply or Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.