java - Date in Spring MVC -
i trying use type=date
in jsp page parse date controller. getting syntactically incorrect data (400 error). tried best find solution failed proper one. please me solve this. suggestions appreciated.
my domain class:
public class doctor{ @datetimeformat(pattern = "mm-dd-yyyy") private date dateofbirth=null; // setter , getter }
jsp code:
<f:input path="dateofbirth" type="date"/>
i tried using @initbinder in contoller well, not succeed.
i try run code , exception happens. cause comes date format on jsp page not same format on java bean. let's change format
@datetimeformat(pattern = "mm-dd-yyyy") private date dateofbirth=null;
to
@datetimeformat(pattern="yyyy-mm-dd") private date dateofbirth=null;
then problem resolved
Comments
Post a Comment