本例使用Spring整合Struts2,需要添加struts2-spring-plugin-2.0.11.jar.
pom.xml配置如下:(这里是spring整合时需要的部分jar包,这里并不都要用到)
spring的jar包:
struts2的jar包:
Struts.xml的配置:其中action的class是spring.xml中bean的id,访问该action时会通过class对应值去spring中寻找相同id值的bean。
其中,前两个constants配置必须写
web.xml的配置: