Пример #1
0
  @RequestMapping(value = "create", method = RequestMethod.POST)
  public String create(@Valid Task newTask, RedirectAttributes redirectAttributes) {
    User user = new User(getCurrentUserId());
    newTask.setUser(user);

    taskService.saveTask(newTask);
    redirectAttributes.addFlashAttribute("message", "创建任务成功");
    return "redirect:/task/";
  }
Пример #2
0
 @RequestMapping(value = "save")
 public String save(Task task, RedirectAttributes redirectAttributes) {
   taskManager.saveTask(task);
   redirectAttributes.addFlashAttribute("message", "创建任务" + task.getTitle() + "成功");
   return "redirect:/task/";
 }