Unable to instantiate Action, xxxAction, defined for 'xxx' in namespace '/'xxxAction解决方案

出现这个问题的原因主要有两个

1、如果项目没有使用Spring,则struts.xml配置文件中,这个action的class属性的路径没有写完整,应该是包名.类名

2、如果项目使用了Spring,那就是applicationContext.xml里面没有为这个action定义bean。这样strus.xml中的对应action的class属性的值就是Spring配置文件中bean的id,比如:

applicationContext.xml

  1. <bean id="adminAction" class="go.derek.action.AdminAction"
  2. scope="prototype">
  3. </bean>

struts.xml
  1. <action name="admin" class="adminAction" method="execute">
  2. <result>/admin.jsp</result>
  3. </action>
合群是堕落的开始 优秀的开始是孤行
原文地址:https://www.cnblogs.com/biaogejiushibiao/p/9509218.html