1.设置ModelAndView对象,根据View的名称和视图解析器跳转到指定的页面。
页面:视图解析器的前缀+view name+视图解析器的后缀
2.通过ServletApi对象来实现,不需要视图解析器的配置
@Controller
public class HelloController {
@RequestMapping("hello.do")
public void hello(ServletRequest req, ServletResponse res) throws IOException{
res.getWriter().println("this is servlet api ");
}
}