2

当我尝试添加在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>
4

1 回答 1

2

I had same exception and just including struts2-spring-plugin-2.3.16.1.jar into build path solved my problem.

于 2014-05-18T18:28:26.667 回答