Announcement Announcement Module
No announcement yet.
Error with HTML5 Date tag in Spring ROO Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Error with HTML5 Date tag in Spring ROO

    I have completely changed the view layer in spring roo application.
    I am trying to use HTML5 tags instead of jspx.

    When I try to get date using html5 date tag, the date is not getting inserted into the database.

    <input type="date" id="birthday" name="dateofbirth" size="20"  />
    Have a look at the controller that handles the request.

        @RequestMapping(method = RequestMethod.POST)
        public String create(@Valid Myclass myclass, BindingResult bindingResult, Model uiModel, HttpServletRequest httpServletRequest) {
            if (bindingResult.hasErrors()) {
            	System.out.println("Value of date: +myclass.getDateofbirth());
                 uiModel.addAttribute("myclass", myclass);
                return "/WEB-INF/JSP/create.jsp";

    The output i am getting here is;

    Value of date: null

    Can anybody help?

    Thanks in advance
    Privin Thomas

  • #2
    Anybody tried it?
    Any advice from spring team?


    • #3
      I haven't tried it, but I'd start by looking at what the browser is actually sending. Is it correctly including dateofbirth=xyz in the post data? At the moment, it isn't clear if the problem is in the browser or in roo's handling of the post data. If the field is correctly being inserted into the post data, it seems unlikely that spring wouldn't handle it correctly on the server. Use some client-side tools to capture what the browser is sending and I suspect you'll find your problem.


      • #4

        The data was properly retrieved from the form but but it was not maching the type of dateofbirth field in the entity layer.

        Just changed the variable declaration to;
        @DateTimeFormat(iso = ISO.DATE)
        private Calendar dateofbirth;
        It worked.

        Anyway thanks a lot for replying.

        Privin Thomas