1.导入包: struts-spring-plugin-xxx.jar
2.在web.xml中加入代码:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
3.配置struts.xml
<constant name="struts.objectFactory" value="spring"></constant>
4.Action类的成员变量名(实际上是getter/setter方法的名称) 与 spring配置文件的Bean id名称相同时,由spring工厂提供对象。