Thymeleaf not displaying Spring form error messages

I think you may be having the same issue as I did – please see :

  • Fields object functions (Spring)

There it is answered by Daniel Fernandez. Basically your form object th:object="${form}" is named "form"
but your controller is looking for "customerForm" (class name) not "form" (the variable name)

can be renamed with @ModelAttribute("data")

copied from that link use:

public String post(@Valid FormData formData, BindingResult result, Model model){
    // th:object="${formData}"
}

or

public String post(@Valid @ModelAttribute("data") FormData data, BindingResult result, Model model){
    // th:object="${data}"
} 

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)