SHARE
TWEET

Untitled

a guest Jul 21st, 2019 83 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @PostMapping("/attorneys")
  2.     public String persistOrMergeAttorney(@ModelAttribute("attorneyForm") @Valid Attorney attorney,
  3.             BindingResult result, Model model,
  4.             final RedirectAttributes redirectAttributes) {
  5.         if(result.hasErrors()) {
  6.             return "attorneys/attorneyForm";
  7.         } else {
  8.             if(creatingNew(attorney)) {
  9.                 attorneyService.persist(attorney);
  10.                 redirectAttributes.addFlashAttribute("css", "success");
  11.                 redirectAttributes.addFlashAttribute("msg", "Attorney added successfully!");
  12.             } else {
  13.                 attorneyService.merge(attorney);
  14.                 redirectAttributes.addFlashAttribute("css", "success");
  15.                 redirectAttributes.addFlashAttribute("msg", "Attorney updated successfully!");
  16.             }
  17.             return "redirect:/attorneys/" + attorney.getId();
  18.         }
  19.     }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top