Beispiel #1
0
 @RequestMapping(value = "/create", method = RequestMethod.POST)
 public String saveNew(@Valid @ModelAttribute Task task, BindingResult result, Model model) {
   if (result.hasErrors()) {
     return "todo/edit";
   }
   todoService.saveTask(task);
   return "redirect:/todo/" + task.getId() + "/edit";
 }
Beispiel #2
0
 @RequestMapping(value = "/{taskId}/edit", method = RequestMethod.POST)
 public String saveEdit(@Valid @ModelAttribute Task task, BindingResult result, Model model) {
   todoService.saveTask(task);
   return "redirect:/todo/" + task.getId() + "/edit";
 }