hasErrors metodu
Şöyle yaparız.
Şöyle yaparız.
@PostMapping
public String doAction(@Valid @ModelAttribute("myModel") MyModel myModel,
BindingResult bindingResult,
RedirectAttributes redirectAttrs) throws Exception {
if (bindingResult.hasErrors()) {
return "thepage";
}
// service logic
redirectAttrs.addFlashAttribute("success", "My Model was added successfully");
return "redirect:/thepage";
}
Hiç yorum yok:
Yorum Gönder