解决方案 »

  1.   

    这个struts.xml的内容
    <?xml version="1.0" encoding="UTF-8" ?>
    <!DOCTYPE struts PUBLIC
    "-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
    "http://struts.apache.org/dtds/struts-2.3.dtd"><struts> <package name="default" namespace="/" extends="struts-default"> <action name="login" class="com.jacksen.struts2Demo01.UserAction">
    <result>/userlogin.jsp</result> </action>
    <action name="check" class="com.jacksen.struts2Demo01.UserAction" method="execute">
    <result name="success">/success.jsp</result>
    <result name="fail">/fail.jsp</result>
    </action>
    </package>
    <!-- Add packages here --></struts>
      

  2.   

    web.xml
    <?xml version="1.0" encoding="UTF-8"?>  
    <web-app version="3.0"   
        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_3_0.xsd"> 
    <display-name>Struts2Demo</display-name> <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.   

    http://localhost/Struts2_Demo01/login.action
      

  4.   

    问题解决了。我的action类忘了继承【ActionSupport】这个类了。
    唉,真是粗心大意。加上了之后,在地址栏中输入http://localhost/Struts2_Demo01/login.action,就没有错误了。
    但是如果在【web.xml】中配置【<welcome-file>】的时候貌似不能写某一个action,我就是在这里边写了login.action,
    虽然输入上边那个url正确了,但是如果让eclipse自动弹出网页的时候还是会报错。
    所以,把【<welcome-file>】改了就对了。
      

  5.   

    我配置的时候 action没有继承ACctionSupport能运行啊,能访问action
    structs。xml:
     <constant name="struts.enable.DynamicMethodInvocation" value="true" />
        <constant name="struts.devMode" value="true" />JSP:
    action=" actionname!method.action"就可以直接访问了