【SpringMVC】配置视图解析器

发布于:2021-10-23 08:50:12

配置逻辑视图名所要用到的关键类org.springframework.web.servlet.view.InternalResourceViewResolver


?








?


?


在Action中只需写出逻辑地址即可


?


public ModelAndView handleRequest(HttpServletRequest request,
HttpServletResponse response) throws Exception {
System.out.println("handleRequest");
//ModelAndView表示向视图封装数据和真实路径
ModelAndView modelAndView = new ModelAndView();
modelAndView.addObject("message","你好,SpringMVC");
//modelAndView.setViewName("/jsp/success.jsp");
modelAndView.setViewName("success");
return modelAndView;
}

?


?


?


?


?


?


?

相关推荐

最新更新

猜你喜欢