Announcement Announcement Module
Collapse
No announcement yet.
CustomDateFormat doesn't get applied after submit Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • CustomDateFormat doesn't get applied after submit

    I have a problem with a date field. When the form is first loaded the date (loaded from the database) is formatted correctly. When I submit the form (which navigates back to itself) the date is formatted in a different format. If I navigate away to another page and come back, the formatting is correct again. Any ideas? TIA.

    My controller overrides the initBind:

    Code:
    protected void initBinder(HttpServletRequest request, ServletRequestDataBinder binder) throws Exception {
      super.initBinder(request, binder);
      binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat("MM/dd/yyyy"), true));
    }
    My JSP:

    Code:
    <spring:bind path="registration.birthDate">
      <input type="text" name="${status.expression}" id="birthDate" value="${status.value}" maxlength="10"/>
    </spring:bind>
    And the date does save correctly -- its just the formatting that is incorrect. Thanks for looking!

    -Jon
Working...
X