java - Struts 2 Spring 3 集成,未找到操作类

标签 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>

Action 类别:

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>

最佳答案

我遇到了同样的异常,只需将 struts2-spring-plugin-2.3.16.1.jar 包含到构建路径中就解决了我的问题。

关于java - Struts 2 Spring 3 集成,未找到操作类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19082083/

相关文章:

Spring 与 JMS 和 DB 的集成和事务

android - 从android http登录到grails 3 spring安全

java - Hibernate HQL 将时间戳与 null 进行比较

java - 按类型表映射子类(多对一 Hibernate)

java - JPanels 没有出现在 Eclipse IDE 中?

Java while循环打印平方数不能使用int?

spring - 如果对象尚不存在,则将其保存在数据库中(Hibernate和Spring)

java - hibernate :What makes JDBC connections expensive?

java - 基于 BIRT 中的另一个表更改表值

java - 为什么 println 时有值显示却出现空指针异常?