ToDoController.java1(R)

関連タイピング
-
src/main/resources
プレイ回数67英語長文294打 -
src/main/resources
プレイ回数83英語長文105打 -
src/main/resources
プレイ回数97英語長文279打 -
src/main/java
プレイ回数82英語長文240打 -
src/main/java
プレイ回数88英語長文254打 -
src/main/java
プレイ回数83英語長文398打 -
src/main/resources
プレイ回数103英語長文815打 -
src/main/java
プレイ回数86英語長文187打
問題文
(@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";
(})
}
(})
}