[JAVA] About error when implementing spring validation

HTTP status 400- Bad Request
Type status report

Description The server cannot or will not process the request due to something
that is perceived to be a client error (e.g., malformed request syntax, 
invalid request message framing, or deceptive request routing).

Apache Tomcat/8.5.32

From the conclusion, the order of "BindingResult" is wrong.

I was using the "BindingResult" object as an argument in the POST controller that sent the request, but the order was wrong.

@RequestMapping(value = "/hoge", method = RequestMethod.POST)
public String hogeHoge(@Valid @ModelAttribute EmployeeListForm form, BindingResult result, Model model) {
    if (result.hasErrors()) {
        model.addAttribute("title", "error");
        model.addAttribute("message", "Please eliminate the following error");
    } else {
        EmployeeDto dto = new EmployeeDto();
        BeanUtils.copyProperties(form, dto);
        employeeList.add(dto);
        model.addAttribute("title", "Employee list");
        model.addAttribute("message", form.getName() + "Has been registered.");
        model.addAttribute("employeeListForm", new EmployeeListForm());
    }
    model.addAttribute("employeeList", employeeList);
    return "hoge";
}

In this way, the argument hogeHoge (form object, BindingResult, Model) Must be in the order of

Recommended Posts

About error when implementing spring validation
Error in implementation when implementing Spring validation
Spring validation and error code
About Spring Framework context error
About Spring ③
Javaw.exe error when starting Spring Boot (STS)
About Spring AOP
About spring AOP
Spring --Error / Error avoidance when creating API for POST
About No Method Error
About Ruby error messages
About Spring Security authentication
[Rails] About error resolution when installing devise and activeadmin
Error when using SnapKit
About DI of Spring ①
About Spring AOP Pointcut
About DI of Spring ②
Error when bundle install
Self-made Validation with Spring
Error when deploying EC2
When an error occurs even though validation is not set
How to resolve Missing Template error when implementing comment function
A validation error occurred when saving to the intermediate table.
[Personal memo] About Spring framework
About validation methods in JUnit
API (when implementing asynchronous communication)
Error when playing with java
Error in Spring database connection
SpringBoot + Mybatis error when booting
Error when introducing SNS authentication
Spring single item validation test
Spring Boot validation message changes
About Spring DI related annotations
I get a 404 error when testing forms authentication with Spring Security
Unknown error in line 1 of pom.xml when using Spring Boot in Eclipse