Skip to content

Instantly share code, notes, and snippets.

@openbooks
Created July 20, 2015 13:22
Show Gist options
  • Save openbooks/847178d010cd1b296b75 to your computer and use it in GitHub Desktop.
Save openbooks/847178d010cd1b296b75 to your computer and use it in GitHub Desktop.
@Controller
public class UserListController {
@Autowired
private UserService userService;
// URL「/user」, HTTPメソッドGETとマッピング
@RequestMapping(value = "/user", method = RequestMethod.GET)
public String showAllPerson(
@RequestParam("userId") int userId, Model model) {
User user = userService.fingbyId(userId);
// Viewに渡すオブジェクトを設定
model.addAttribute("user", user);
// View名をreturn
return "user/detail";
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment