Messages:
1.cn.itcast.action.CustomerAction
2.Unable to instantiate Action, cn.itcast.action.CustomerAction, defined for 'CustomerAction' in
namespace '/'cn.itcast.action.CustomerAction
File:
org/apache/catalina/loader/WebappClassLoader.java
Line number:
1,718
Stacktraces
Unable to instantiate Action, cn.itcast.action.CustomerAction,
defined for 'CustomerAction' in namespace '/'cn.itcast.action.CustomerAction -
action - file:/D:/develop/apache-tomcat-7.0.52/apache-tomcat-7.0.52/webapps/crm_ssh/WEB-INF/classes/struts.xml:12:88
找到一个不能处理的问题,不能展示action,这个问题是在struts.xml中,一般是文件的路径配置上除了错误
例如在如下程序过程中由于路径写错就会报这个错误:
<action name="CustomerAction_*" class="cn.shop.action.CustomerAction" method="{1}"></action>
把class属性更正为:
<action name="CustomerAction_*" class="cn.shop.web.action.CustomerAction" method="{1}"></action>
就可以了!
2,再比如:
Messages: · There is no Action mapped for namespace [/crm] and action name [CustomerAction] associated with context path [/crm_ssh].
Stacktraces
There is no Action mapped for namespace [/crm] and action name [CustomerAction] associated with context path [/crm_ssh]. - [unknown location]
这个是一个路径书写错误,struts2很委婉的表达了404的错误,大概意思是在/crm下没有找到想要的action,实际上根本没有配置/crm路径,crm只是一个包名而已,和路径无关,错误认识的代码:
<package name="crm" extends="struts-default" namespace="/">
<action name="CustomerAction_*" class="cn.itcast.web.action.CustomerAction" method="{1}">
这个路径访问的路径应该是:http://localhost:8080/项目名称/CustomerAction_*
如果CustomerAction_中只有一个execute方法,直接访问:http://localhost:8080/项目名称/CustomerAction也可以