日期:2014-05-18  浏览次数:20622 次

There is no Action mapped for namespace [/] and action name [] associated with c
问题如下:



这个问题困扰我好几天了,试过各种答案,还是不行,请各位大侠指点…………
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>
     <constant name="struts.devMode" value="true" /> 
     <constant name="struts.enable.DynamicMethodInvocation" value="true" />
     <package name="default" extends="struts-default" namespace="/" >
          <action name="helloAction" class="action.HelloAction">
               <result name="success">/helloworld.jsp</result>
          </action>
     </package>        
</struts>



web.xml代码如下:

<?xml version="1.0" encoding="UTF-8" ?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         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" 
         version="3.0">
<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>
</web-app>



Action类代码如下:
package action;

public class HelloAction {

private String message;

public String getMessage() {
return message;
}

public void setMessage(String message) {
this.message = message;
}

private String execute(){
message = "first Struts App!";
return "success";
}

}


我的项目文件里没有struts.properties文件,不知是不是这个问题?
还有是不是版本问题,我用的Eclipse 是最新的IDE FOR JavaEE 的kepler版本,Struts是2.3.15.3版本,Tomcat 7.0.42, JDK7,我只是想搭建好一个Struts环境,然后可以正常启动就行了!
另外的项目分布如下:

错误提示情况如下:


十一月 02, 2013 7:19:25 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.validator.ActionValidatorManager)
十一月 02, 2013 7:19:25 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger info
信息: Choosing bean (struts) for (com.opensymphony.xwork2.util.ValueStackFactory)
十一月 02, 2013 7:19:25 下午 com.opensymphony.