Spring整合Struts2

来源:互联网 发布:海贼王好看的小说知乎 编辑:程序博客网 时间:2024/05/16 08:23

本例使用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的配置:
这里写图片描述
这里写图片描述

1 0
原创粉丝点击