解决Spring mvc 使用多种viewResolver的问题

解决:
JstlView
Java代码 复制代码  收藏代码
public boolean checkResource(Locale locale) throws Exception {
		return true;
	}


罪魁祸首 就是spring实现该方法时返回true,这样相当于view总是存在,从而导致其余视图解析器无法得到解析机会。

覆盖该方法,应该就可以了。

Java代码 复制代码  收藏代码
  1. public class IcomJstlView extends JstlView {   
  2.   
  3.     public boolean checkResource(Locale locale) throws Exception {   
  4.         File file = new File(this.getServletContext().getRealPath("/")+getUrl());   
  5.         return file.exists();//判断该jsp页面是否存在   
  6.     }   

http://www.iteye.com/problems/76107

猜你喜欢

转载自guosxu.iteye.com/blog/1407170