1. ModelAndView
public class IndexController implements Controller{
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView mv = new ModelAndView("/WEB-INF/view/index.jsp");
mv.addObject("data","hello Spring MVC");
return mv;
}
}
2. View Resolver 기능
public class IndexController implements Controller{
@Override
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
ModelAndView mv = new ModelAndView("index");
/WEB-INF/view/ ~ .jsp
mv.addObject("data","hello Spring MVC");
return mv;
}
}
3. View Resolver 설정
4. 결과