コード例 #1
0
 @RequestMapping(value = "save")
 public String save(Task task, RedirectAttributes redirectAttributes) {
   taskManager.saveTask(task);
   redirectAttributes.addFlashAttribute("message", "创建任务" + task.getTitle() + "成功");
   return "redirect:/task/";
 }
コード例 #2
0
 @RequestMapping(value = "delete/{id}")
 public String delete(@PathVariable("id") Long id, RedirectAttributes redirectAttributes) {
   taskManager.deleteTask(id);
   redirectAttributes.addFlashAttribute("message", "删除任务成功");
   return "redirect:/task/";
 }
コード例 #3
0
 @RequestMapping(value = {"list", ""})
 public String list(Model model) {
   List<Task> tasks = taskManager.getAllTask();
   model.addAttribute("tasks", tasks);
   return "taskList";
 }