ToDoController.java1(R)
関連タイピング
-
プレイ回数54英語長文187打
-
プレイ回数44英語長文294打
-
プレイ回数56英語長文105打
-
プレイ回数62英語長文815打
-
プレイ回数41英語長文492打
-
プレイ回数42英語長文168打
-
プレイ回数42英語長文771打
-
プレイ回数58英語長文410打
問題文
(@Controller)
@Controller
(@RequestMapping("/todos"))
@RequestMapping("/todos")
(@RequiredArgsConstructor)
@RequiredArgsConstructor
(public class ToDoController {)
public class ToDoController {
(private final ToDoService toDoService;)
private final ToDoService toDoService;
(//read)
//read
(@GetMapping)
@GetMapping
(public String list(Model model) {)
public String list(Model model) {
(model.addAttribute("todos", toDoService.findAllToDo());)
model.addAttribute("todos", toDoService.findAllToDo());
(return "todo/list";)
return "todo/list";
(})
}
(//read(detail))
//read(detail)
(@GetMapping("/{id}"))
@GetMapping("/{id}")
(public String detail(@PathVariable("id") Integer id, Model model,)
public String detail(@PathVariable("id") Integer id, Model model,
(RedirectAttributes attributes) {)
RedirectAttributes attributes) {
(ToDo ToDo = toDoService.findByIdToDo(id);)
ToDo ToDo = toDoService.findByIdToDo(id);
(if (ToDo != null) {)
if (ToDo != null) {
(model.addAttribute("todo", toDoService.findByIdToDo(id));)
model.addAttribute("todo", toDoService.findByIdToDo(id));
(return "todo/detail";)
return "todo/detail";
(} else {)
} else {
(attributes.addFlashAttribute("errorMessage", "taishoude-tagaarimasenn");)
attributes.addFlashAttribute("errorMessage", "taishoude-tagaarimasenn");
(return "redirect:/todos";)
return "redirect:/todos";
(})
}
(})
}