Fix controllers to use Post/Redirect/Get
Forms should use Post/Redirect/Get pattern.
@@ -36,7 +36,7 @@ public class UserController {
userRepository.save(user);
model.addAttribute("users", userRepository.findAll());
- return "index";
+ return "redirect:/index";
}
@GetMapping("/edit/{id}")
@@ -55,7 +55,7 @@ public class UserController {
userRepository.save(user);
model.addAttribute("users", userRepository.findAll());
- return "index";
+ return "redirect:/index";
}
@GetMapping("/delete/{id}")
