Code example for ModelAndView

Methods: getModelgetViewName

0
		String viewName = "viewName"; 
		ParameterizableViewController pvc = new ParameterizableViewController(); 
		pvc.setViewName(viewName); 
		// We don't care about the params. 
		ModelAndView mv = pvc.handleRequest(new MockHttpServletRequest("GET", "foo.html"), null); 
		assertTrue("model has no data", mv.getModel().size() == 0); 
		assertTrue("model has correct viewname", mv.getViewName().equals(viewName)); 
		assertTrue("getViewName matches", pvc.getViewName().equals(viewName)); 
	} 
 
	public void testServletForwardingController() throws Exception { 
		ServletForwardingController sfc = new ServletForwardingController(); 
		sfc.setServletName("action"); 
		doTestServletForwardingController(sfc, false); 
	} 
 
	public void testServletForwardingControllerWithInclude() throws Exception { 
		ServletForwardingController sfc = new ServletForwardingController(); 
		sfc.setServletName("action"); 
		doTestServletForwardingController(sfc, true);