日期:2014-05-19  浏览次数:20660 次

Struts2一直报错,求解....
这两天用ecplise新建一个struts2的项目,但是访问的时候一直报错,
警告: Could not find action or result
There is no Action mapped for namespace [/] and action name [login] associated with context path [/migo]. - [unknown location]
at com.opensymphony.xwork2.DefaultActionProxy.prepare(DefaultActionProxy.java:185)
at org.apache.struts2.impl.StrutsActionProxy.prepare(StrutsActionProxy.java:63)


网上查看好多解决方法,但是都没有解决,实在找不出错误的地方,请高人指点。

这个是项目目录


这个是web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
  <display-name>Migo</display-name>
  
  <filter>  
        <!-- 配置Struts2核心Filter的名字 -->  
        <filter-name>struts2</filter-name>  
        <!-- 配置Struts2核心Filter的实现类 -->  
        <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>  
    </filter>  
    <!-- 配置Filter拦截的URL -->  
    <filter-mapping>  
        <!-- 配置Struts2的核心FilterDispatcher拦截所有用户请求 -->  
        <filter-name>struts2</filter-name>  
        <url-pattern>/*</url-pattern>  
    </filter-mapping>  
    
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

这个是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>
    <!-- struts2的action必须放在一个指定的包空间下定义 -->
    <package name="default" extends="struts-default">
    <!-- 定义处理请求URL为login.action的Action -->
        <action name="login" class="sdsdmigo.login.action.LoginAction">
        <!-- 定义处理结果字符串和资源之间的映射关系 -->
            <result name="success">/success.jsp</result>
            <result name="error">/error.jsp</result>
        </action>
    </package>
</struts>

这个是项目启动信息
201