哪位大侠能帮小弟解决下这个问题!WebApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());这个appContext对象为空?。。出了空指针异常,  这是怎么回事?请大侠赐教!

解决方案 »

  1.   

    servlet的话
    WebApplicationContextUtils.getWebApplicationContext(this.getServletContext()); 
    就可以了
      

  2.   

    问题出在request.getSession().getServletContext()这里,楼主是想得到session里面的内容?
      

  3.   

    谢谢楼上所有人士! 我只想用SPRING产生个对象!获取上下文有2种方式吧!
          我想用web方式生成对象!
      

  4.   

    this.getServletContext()   没有这个方法
      

  5.   

    servlet中没有this.getServletContext()?我汗。
      

  6.   

    actionaction也是servlet啊  真没有这个!但是有this.getServlet();
      

  7.   

    this.getServlet().getServletContext();这样的?