java/스프링공부

스프링에서 controller에서 return페이지가 없는 void함수

Dev갱이 2020. 6. 28. 18:53
728x90

@RequestMapping("/member/*");

 

1)

@RequestMapping(value="/register", method=RequestMethod.GET);

public void getRegister() throws Exceptions{

  

}

2)

@RequestMapping(value="/register", method=RequestMethod.GET);

public String getRegister() throws Exceptions{

  

  return "member/register";

}

 

두가지의 결과값은 같다.

void 로 설정하면 현재 호출한 url의 경로로 뷰를 찾는다. 알아두면 좋을것 같다.

728x90