Spring form ModelAttribute field validation to avoid 400 Bad Request Error
问题 I've got an ArticleFormModel containing data sent by normal html form which is injected by Spring using @ModelAttribute annotation, i.e. @RequestMapping(value="edit", method=RequestMethod.POST) public ModelAndView acceptEdit(@ModelAttribute ArticleFormModel model, HttpServletRequest request, BindingResult errors) { //irrelevant stuff } Everything works perfectly fine up to some point. The problem is that the ArticleFormModel contains a double field ( protected , set using normal setter).