gpt4 book ai didi

java - Struts 2 Spring 3 集成,找不到 Action 类

转载 作者:行者123 更新时间:2023-11-30 09:17:11 26 4
gpt4 key购买 nike

当我尝试添加在 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 集成,找不到 Action 类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19082083/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com