Struts 2 Spring 3集成,没有找到动作类

时间:2013-09-29 19:05:27

标签: java spring hibernate struts2 integration

当我尝试添加CustomerAction类中定义的不同方法时,系统进入方法但是在执行该方法后,Struts无法检测到类bean名称:

Invalid action class configuration that references an unknown class named [customerActionBean]

struts.xml

<constant name="struts.devMode" value="false" />    
<package name="myPack" extends="struts-default">
    <action name="customerAction" class="customerActionBean">
        <result name="successView">/success.jsp</result>
    </action>
    <action name="welcome" class="customerActionBean" method="welcome">
        <result name="successView">/index2.jsp</result>
    </action>
</package>

动作类:

public String execute() throws Exception {
    customerService.addCustomer(customer);
    savedCustomerList=customerService.getCustomers();
    return "successView";
}

public String welcome(){
    System.out.println("girdiiiiiii");
    savedCustomerList=customerService.getCustomers();
    return "succesView";
}

应用程序上下文:

<bean id="customerActionBean" class="com.thecafetechno.CustomerAction" >
    <property name="customerService" ref="CustomerService" />

</bean>

1 个答案:

答案 0 :(得分:2)

我有同样的例外,只是在构建路径中包含 struts2-spring-plugin-2.3.16.1.jar 解决了我的问题。