struts2和spring结合问题,很着急啊。。。

我用struts2和spring结合的时候出错了,已经3天了,希望大家帮忙哈,小弟真的很急啊。。。
我action里面这样配置的,采取让spring管理action
@Component("woyun")
@Scope("prototype")
public class OrgAction extends ActionSupport implements RequestAware{
@Override
public String execute() throws Exception {
System.out.println(parentId);
//System.out.println(orgManager.findOrgs(parentId));
//request.put("orgs", orgManager.findOrgs(parentId));
return SUCCESS;

struts 配置文件是这样配的:



/org/index.jsp
/org/add_input.jsp
/org/add_success.jsp
/org/del_success.jsp

但是总是出错啊 :

Caused by: Action class [woyun] not found - action - file:/D:/apache-tomcat-6.0.16/webapps/oa_01/WEB-INF/classes/struts.xml:11:42

大哥们,难道我这样配置出错了吗》?这是老师讲的让spring来管理action啊,为什么不能啊 ,还有啊 即使我action里面什么都不写, 配置文件写全名字,这样也不行啊????哎 真的好难受啊,谁知道赶紧和我说说哈!!万分感谢啊

首先添加struts-spring-plugin jar到web-inf/lib
然后在web.xml中添加
[code="java"]

org.springframework.web.context.ContextLoaderListener
[/code]

然后在struts.xml或struts.properties文件中添加
[code="java"]

[/code]

这样应该能解决问题

这行配置有加没


你配的名字是org 所以你应该访问 org.action (Struts 2.x) 或 org.do(Struts 1,x)

你的 OrgAction 这个类是否有被 spring 扫描进 Ioc 容器 ?

不要以为写个注解就是写进去了

如: 若你的 OrgAction 类是在 com.web 包下, 需要在 spring 配置文件中添加:

这是 spring 的配置, 与 struts 2 无关. 只要将 struts2-spring-plugin.jar 加载进来后, 就不需要写

而且, 遇到问题自己多想想, 不要总想着问人.

[code="java"] [/code]
class没有包?