HTTP Status 400 - Bad Request - Spring MVC

Asked

Viewed 1,597 times

0

When trying to call a Controller method this returns the error below:

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.0.53

Controller:

@Controller
public class ManterFuncionarioController {

@RequestMapping("CriarFuncionario")
    public String criarFuncionario(Model model, Funcionario funcionario, Usuario usuario, BindingResult result){
    ///METODO///
}

}

I am using JSP

I looked for solutions on other topics, but none solved.

1 answer

1


Try to specify the type of request: Post, Get, etc. In your case I believe it is a Post, then the method would look like this:

    @Controller
    @RequestMapping("/funcionarios")
    public class ManterFuncionarioController {

    @RequestMapping(method = RequestMethod.POST, path = "/criar")
        public String criarFuncionario(Model model, Funcionario funcionario, Usuario usuario, BindingResult result){
        ///METODO///
    }
}

In the above example to save you will have to access http://localhost:8080/employees/create and specify your request as Post.

  • I decided to remove some parameters from my Controller method, probably some error in mapping from JSP to Controller that is incorrect.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.