是这个
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>

解决方案 »

  1.   

    把你的web.xml的内容贴出来,看一下
      

  2.   

    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.5"
    xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <listener>
    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
    </listener>
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>classpath:applicationContext.xml</param-value>
    </context-param>
    <filter>
    <filter-name>struts2</filter-name>
    <filter-class>
    org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
    </filter-class>
    </filter>
    <filter-mapping>
    <filter-name>struts2</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping> <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
    </welcome-file-list>
    </web-app>
      

  3.   

    ActionContext context=ActionContext.getContext();
    这不能定义在方法外吗?
      

  4.   

    没发现问题,你把struts的配置文件发一下,还有访问路径
      

  5.   

    刚刚把tomcat里的项目移除了,再重新发布重启tomcat就好了,是tomcat出问题了么,谢谢上面两位了,怎么送分呀,第一次来这