url : http://localhost:8080/myFriends?gubn=test

 

request.getParameter
@RequestMapping(value = "/myFriends")
	public String myFriendsList( HttpServletRequest req, Model model ){
		String gubn = req.getParameter("gubn");
		System.out.println(gubn);
		return "MyFriends";
	}
test

 

@requestParam
@RequestMapping(value = "/myFriends")
	public String myFriendsList( @RequestParam String gubn, Model model){
	System.out.println(gubn);
	return "MyFriends";
}
test

 

url : http://localhost:8080/myFriends/1

 

@PathVariable
@RequestMapping(value = "/myFriends/")
	public String myFriendsList( @PathVariable String idx, Model model){
		System.out.println(idx);
		return "MyFriends";
}
1

'스프링' 카테고리의 다른 글

[Spring] 톰캣 설치 및 설정  (0) 2019.03.30
[Spring] Mysql 다운  (0) 2019.03.30
[Spring] sts 다운  (0) 2019.03.30
[Spring] JDK 환경변수 잡기  (0) 2019.03.30
[스프링] Hello World 찍기  (0) 2019.02.18
복사했습니다!