Spring MVC 3.0 InternalResourceViewResolver custom view file
I have a view resolver:
<bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/&g开发者_如何学Got;
<property name="order"><value>1</value></property>
</bean>
And a method:
@RequestMapping("/hello_world.html")
public ModelAndView index() {
ModelAndView mav = new ModelAndView("test");
return mav;
}
I would like to render /WEB-INF/jsp/test.jsp but it always try to render /WEB-INF/jsp/hello_world.jsp
How can I define custon view page inside index()?
Thank you
Import org.springframework.web.servlet.ModelAndView instead of org.springframework.web.portlet.ModelAndView! ;^)
@RequestMapping("/hello_world.html")
public ModelAndView index() {
ModelAndView mav = new ModelAndView("/test");
return mav;
}
Instead of "test", do "/test"
精彩评论