我正在嘗試使用與 GET 和 POST 請求相同的 URI 來制作控制器。但是我遇到了以下錯誤。Ambiguous handler methods mapped for HTTP path 'http://localhost:8080/boards/forgotPassword/recoverForm':據(jù)我所知,它不應(yīng)該發(fā)生,因為一個使用 GET 請求而另一個使用 POST。如果我錯了,請糾正我??刂破髟敿?xì)信息如下。@Controller@RequestMapping(value = "/forgotPassword", method = RequestMethod.GET)public class PasswordResetController { @ModelAttribute("userEmail") public UserEmail makeUserEmailDTO () { UserEmail userEmail = new UserEmail(); return userEmail; } //@RequestMapping(value = "/recoverForm", method = RequestMethod.GET) --> same error @GetMapping("/recoverForm") public String getRecoverForm () { return "_recoverForm"; } //@RequestMapping(value = "/recoverForm", method = RequestMethod.POST) --> same error @PostMapping("/recoverForm") public String sendRecoverEmail (@ModelAttribute("userEmail") @Valid UserEmail userEmail, BindingResult result) { System.out.println(userEmail.getEmail()); return "_temp"; }}
添加回答
舉報
0/150
提交
取消