spring_mvc(六)Rendering Views

HTML generated by JSP template

@RequestMapping(value="/html", method=RequestMethod.GET)
public ModelAndView prepare() {
	System.out.println("aaa");
	ModelAndView mav = new ModelAndView("test_mvc");
	mav.addObject("foo", "bar");
	mav.addObject("fruit", "apple");
	return mav;
}



<context:component-scan base-package="net.viralpatel.spring3.controller" />
<bean id="viewResolver"
	class="org.springframework.web.servlet.view.UrlBasedViewResolver">
	<property name="viewClass"
			value="org.springframework.web.servlet.view.JstlView" />
	<property name="prefix" value="/WEB-INF/jsp/" />
	<property name="suffix" value=".jsp" />
</bean>

你可能感兴趣的:(spring)