Struts2与Spring3整合遇到Action not found问题的解决

来源:互联网 发布:重庆市知行卫校 编辑:程序博客网 时间:2024/05/21 20:26

近来要建立SSH的项目框架,整合Struts2与Spring3时候发现,Struts2的Action已托管到Spring3,并且在Struts2配置的class节点指向Spring的Bean ID(参考),但项目启动时仍然报Action not Found 。 究其原因是Struts和Spring之间的整合还需要另一个jar包(struts2-spring-plugin),通过plugin引入ActionAutowiringInterceptor拦截器,按照class的名字注入Spring托管的Action。

解决思路:

1、导入struts2-spring-plugin-2.2.2.3.1.jar

2、在Struts的配置里面引入struts-plugin

struts.xml

<include file="struts-default.xml" />

<include file="struts-plugin.xml" />

问题就解决了


原创粉丝点击