0
我有一個觀點解析:
的Spring MVC作爲UrlBasedViewResolver自定義視圖文件
<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/views/" />
<property name="suffix" value=".jsp" />
</bean>
和控制器:
@RequestMapping(value = "/home", method = RequestMethod.GET)
public String loadPage(HttpServletRequest request,HttpServletResponse response, HttpSession session,ModelMap modelMap) {
String langlayout = "eng";
UrlBasedViewResolver urlResolver = new UrlBasedViewResolver();
urlResolver.setPrefix("/WEB-INF/views/"+langlayout);
urlResolver.setSuffix(".jsp");
return "home/list.jsp";
}
點擊在jsp後,其仍然在尋找在WEB-INF/views/home/list而不是WEB-INF/views/eng/home/list
如何定義自定義視圖頁面
是的,我試過this..but我有一個時間的配置做到這一點的解決方案?像鏈式視圖解析器 –