1、配置Struts2主配置文件

Spring整合Struts2

2、配置struts2核心过滤器到web.xml

Spring整合Struts2
struts2与Spring整合

1、导包(struts2-spring-plugin-2.3.24.jar)

Spring整合Struts2
2、需要配置常量

### if specified, the default object factory can be overridden here
### Note: short-hand notation is supported in some cases, such as "spring"
###       Alternatively, you can provide a com.opensymphony.xwork2.ObjectFactory subclass name here
# struts.objectFactory = spring

### specifies the autoWiring logic when using the SpringObjectFactory.
### valid values are: name, type, auto, and constructor (name is the default)
struts.objectFactory.spring.autoWire = name


<!--   # struts.objectFactory = spring   将aciton的创建交给Spring容器
             struts.objectFactory.spring.autoWire = name spring负责装配Action依赖属性
     -->

Spring整合Struts2
     

相关文章: