我用的struts-2.2.3.1版本 自己配置了一些 然后启动服务器报的错误是
严重: Exception starting filter struts2

解决方案 »

  1.   

    web.xml
    <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>
      

  2.   

    首先配 WEB.XML  然后还要 配 STRUTS.XML   
      

  3.   

    web.xml,我一般这么配置
    <filter>
      <filter-name>struts2</filter-name>
      <filter-class>
      org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
      </filter-class>
      </filter>
     
      <filter>
    <filter-name>strutsFilterDispatcher</filter-name>
    <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
    </filter>
      
      <filter-mapping>
      <filter-name>struts2</filter-name>
      <url-pattern>*.action</url-pattern>
      </filter-mapping>
       
      <filter-mapping>
    <filter-name>strutsFilterDispatcher</filter-name>
    <url-pattern>/*</url-pattern>
    </filter-mapping>然后struts.xml中还要做一些配置来控制页面的跳转等。
      

  4.   


    在web.xml配置
    <filter>
            <filter-name>struts2</filter-name>
            <!-- struts 2.1.6以下版本用org.apache.struts2.dispatcher.FilterDispatcher-->
            <!-- struts 2.1.6以上版本用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter -->
            <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>struts.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
    <!-- 默认的视图主题 -->
        <constant name="struts.ui.theme" value="simple" />
        <!-- 把struts2的Action对象工厂 交给spring的对象工厂来创建Action -->
        <constant name="struts.objectFactory" value="spring" />
        
      <package name="login" namespace="/login" extends="struts-default">
    <action name="login" class="loginAction">
    <result name="main">/jpf/root/main.jsp</result>
    <result name="index">/login.jsp</result>
    </action>
        </package>
    </struts>
      

  5.   

    把例题中的配置文件copy一份出来,改改就行了.
      

  6.   

    web.xml<filter>
            <filter-name>struts2</filter-name>
            <!-- struts 2.1.6以下版本用org.apache.struts2.dispatcher.FilterDispatcher-->
            <!-- struts 2.1.6以上版本用org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter -->
            <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>
    struts.xml<?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts PUBLIC
        "-//Apache Software Foundation//DTD Struts Configuration 2.0//EN"
        "http://struts.apache.org/dtds/struts-2.0.dtd">
    <struts>
    <!-- 默认的视图主题 -->
        <constant name="struts.ui.theme" value="simple" />
        <!-- 把struts2的Action对象工厂 交给spring的对象工厂来创建Action -->
        <constant name="struts.objectFactory" value="spring" />
        
         <package name="login" namespace="/login" extends="struts-default">
            <action name="login" class="loginAction">
                <result name="main">/jpf/root/main.jsp</result>
                <result name="index">/login.jsp</result>
            </action>
        </package>
    </struts>