Spring MVC : Date problem fix

Add this following code to resolve the date problem in your controller

     private void dateBinder(WebDataBinder binder) {
          // The date format to parse or output your dates
          SimpleDateFormat dateFormat = new SimpleDateFormat("MM/dd/yyyy");
          // Create a new CustomDateEditor
          CustomDateEditor editor = new CustomDateEditor(dateFormat, true);
          // Register it as custom editor for the Date type
          binder.registerCustomEditor(Date.class, editor);


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s