struts2有objectFactory创建action类,spring有自己的springobjectFactory,为了让创建struts2的action类的工作让spring来管理,可以参看struts2的核心包下org.apache.struts2下的default.properties文件,打开看到其中有一个
struts.objectFactory=spring的标签,所以只需要把struts2的struts-plugin.jar文件导进来,放到lib目录下即可。
web.xml中的
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>