0

I have a login button in my site's ui, which when clicked goes to the /login address, which is handled by the controller below. But when I click on this button, the following error occurs. What is the reason? It is written that BindingResult must come after the model, which is the same in my code. I also saw this link, but it did not help.

@RequestMapping(value = "login", method = {RequestMethod.GET, RequestMethod.POST})
    public String showLogin(@RequestParam(required = false) String error,
                            @RequestParam(required = false) String logout,
                            @Valid @RequestParam(required = false) @NotBlank(message = "username should not be blank") String username,
                            @Valid @RequestParam(required = false) @NotBlank(message = "password should not be blank") String password,
                            Model model,
                            BindingResult result) {
        ...
}

error:

An Errors/BindingResult argument is expected to be declared immediately after the model attribute, the @RequestBody or the @RequestPart arguments to which they apply: public java.lang.String com.isoft.controllers.LoginController.showLogin(java.lang.String,java.lang.String,java.lang.String,java.lang.String,org.springframework.validation.BindingResult,org.springframework.ui.Model)
Alien
  • 15,141
  • 6
  • 37
  • 57
munknown
  • 53
  • 4

0 Answers0