Created
November 3, 2021 11:32
-
-
Save alexchirea/bf78ec9507037619890005a9ca2e4eec to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@GetMapping("/add") | |
public String showAddPersonForm(Person person) { | |
return "add-person"; | |
} | |
@PostMapping("/add") | |
public String addPerson(@Valid Person person, BindingResult result, Model model) { | |
if (result.hasErrors()) { | |
return "add-person"; | |
} | |
repository.save(person); | |
return "redirect:/index"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment