- I wanted to bind the spring date field to the pojo class and return the date
- The dateOfbirth is of type java.sql.Date . Now when i pass the date from spring form to the function setDateOfBirth ,it is taking null value
For example in register.jsp (Registration form) I have the particular field
<form:label path="DateOfBirth">DateOfBirth</form:label>
<form:input path="DateOfBirth" type="date"/>
Register.java (Pojo class)
public void setDateOfBirth(Date dateOfBirth) {
this.dateOfBirth = dateOfBirth ;
}
public void getDateOfBirth() {
return this.dateOfBirth;
}
when I call getDateOfBirth()
returns: Sat Dec 12 00:00:00 IST 1992
Input :- 12/12/1992
Expected Output :- 12/12/1992
What I get: null
Please help me how to convert this ?