我常用Filter的方法,所以对于你Interceptor的方法,我没有看。对于你的Filter方法的错误。
首先提示的No WebApplicationContext found就是指web.xml中的这个配置是不存在的。<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>除此之外,你还需要加载应用程序上下文<context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:META-INF/applicationContext.xml</param-value>
</context-param>这样你的spring才能跑起来。

解决方案 »

  1.   

    谢谢,我改了,确实不饱错了。可是却不起作用??还是会报could not initialize proxy - no Session
    是不是跟我的hibernate调用方法有关:
    List reList = (List)this.getHibernateTemplate().execute(new HibernateCallback() {
    public Object doInHibernate(Session session) throws HibernateException {
    …………
       }
    }改用this.getHibernateTemplate().find("From UserBean");也不行啊!!!!!
      

  2.   

    你没有配这个:<filter-mapping>   
                    <filter-name>OpenSessionInViewFilter</filter-name>   
                    <url-pattern>*.do</url-pattern>   
    </filter-mapping> 你去
    http://topic.csdn.net/u/20080228/09/7ee41ece-e9b1-45a2-8131-bef7452732bc.html
    这个帖子看下。我贴的一个我的web.xml配置。
      

  3.   

    晕,纠正下。你配置了。
    代码挨在一起没看到。你配的是*.faces 。所以lazyload的仅是.faces的请求。确定下现在你load时的请求是否是这个。
      

  4.   

    然后对filter最好这样配置,这个是我记下来的别人配置的一个配置方法。<filter>   
            <filter-name>OpenSessionInViewFilter</filter-name>   
            <filter-class>   
                     org.springframework.orm.hibernate3.support.OpenSessionInViewFilter 
            </filter-class>   
            <!-- singleSession默认为true,若设为false则等于没用OpenSessionInView -->   
            <init-param>   
                      <param-name>singleSession</param-name>   
                      <param-value>true</param-value>   
            </init-param>   
    </filter>  
      

  5.   

    还有我觉得用Interceptor的方法要好一些,这样就不用到web.xml文件中配置,如果两层是不同的小组写的话。
    所以我最想用第二种方式解决这个问题。多谢。
      

  6.   

    [售后服务]
    to luoxiang2000:刚想贴Interceptor的方法,结果结贴了~~~~~