위로 아래

컨트롤러

@Controller -> return이 jsp 페이지

@Controller
public class MemberController {

	
	@RequestMapping("/test")
	public String test() {
		return "Test";
	}
}

 

 

 

 

레스트 컨트롤러

@RestController -> return이 데이터

@RestController //restAPI를 통해 외부로 값을 전달하는 경우 사용
@RequestMapping("/hello/*")
public class HelloController {

	@RequestMapping("/test")
	public HashMap<String, Object> test(){
		
		HashMap<String, Object> hashMap = new HashMap<String,Object>();
		
		hashMap.put("name", "join");
		hashMap.put("age", "32");
		hashMap.put("gender", "man");
		
		return hashMap;
	}
}