Hi all,I hava some confusions when using @DateTimeFormat.My understanding about @DateTimeFormat is that is's used to validate and convert the string date in the jsp page to the some entity's field whose format is specified by the @DateTimeFormate(eg:yyyy/MM/dd).
Suppose that I hava a contact entity,I get the contact's info and displays it in the edit form,I find that,when I use
<form:input path="birthDate" id="birthDate" />
,its html output will be formatted using the format specified in the @DateTimeFormat,while using the normal way,such as
<p>${contact.birthDate}</p>
,it just output it directly using the date from db.
My questions are:
1.What's @DateTimeFormat's effect? Can it really not only format the string date(in jsp page) to the entity's field but also format the entity's field from db and displays it in the jsp page using the specified format?If so,how spring handle this annotation? Does other formatter annotation work so?
2.Why it just work for the
<form>
tag situation?
3.And further introductions about this will be appreciated.
Thanks.