mvc view rendering

ModelAndView

        VM = ModelAndView new new ModelAndView ();
         // encapsulating data to be displayed on attempting 
        vm.addObject ( "MSG", "Spring Hello" );
         // package name data view 
        vm.setViewName ( "Hello" );
         return VM;

 

The following method does not view the renderer

ServletAPI

/*resp.getWriter().println("---my name is spring mvc");*/

 

Redirects and forwards the request

 

springmvc achieve the first forward

@RequestMapping("/hello1")
public String hello1(){

return "index.jsp";
}

The second

 

Guess you like

Origin www.cnblogs.com/xiaozhang666/p/11648104.html