struts1x与spring2.5集成主要步骤
来源:互联网 发布:站外优化是什么意思 编辑:程序博客网 时间:2024/06/14 04:20
1.导入struts和spring(spring的jar包,common-logging的jar包及log4j.properties)的jar包
2.复制applicationContext-*.xml配置文件到src即classpath能找到的路径或web-inf下
3.配置web.xml文件,加入如下:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath*:applicationContext-*.xml,/WEB-INF/applicationContext-*.xml</param-value>
</context-param>
其中,classpath*:applicationContext-*.xml是指找到classpath路径下的配置文件,注意一定要用*:,WEB-INF同理,多个路径之间用逗号或者空格隔开,这意思即为通过contextConfigLocation读取spring的配置文件。此外还需要配置一个监听,此监听的目的就是为了读取到contextConfigLocation,使其能成功加载spring配置文件,配置如下:
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
4.配置struts配置文件,action标签中别的不变,将原来的请求控制交给spring处理,即将type改为:
type="org.springframework.web.struts.DelegatingActionProxy"
若找不到此类,则找到spring jar包里面的spring-webmvc-struts.jar,复制到lib包下
5.修改spring配置文件,传统的配置方法是<bean id=”” class=”” />,如果将struts与spring结合,需要将spring的id改为name,些name必须唯一,后面还能跟scope=”prototype”,使对象成为多例,这也可以避免单例造成的同步问题。
以上均为个人经验,如有不对请多多指正。
- struts1x与spring2.5集成主要步骤
- ibatis2与Spring2.5集成
- ibatis2与Spring2.5集成
- CXF与Spring2.5集成的若干问题
- hibernate3.2与spring2.5集成
- struts2笔记:与spring2集成
- struts2笔记:与spring2集成
- jackrabbit与spring2.5.6集成
- Spring2.0与Struts的集成
- Quartz与spring2.0集成备忘录
- Mina2.x与Spring2.5.6集成
- mina与spring2.5.6的集成
- xfire1.x 与 spring2.X集成问题
- spring2.0与spring2.5的差别
- Spring2.5 + Hibernate3.2 集成实例(CTO)
- JPA和Spring2.5集成配置
- JPA+Spring2.5+Struts2.1.8 集成(一)
- JPA+Spring2.5+Struts2.1.8 集成(二)
- LoadImage加载到系统OEM图片的BUG解决方案
- 电脑知识(系统操作)
- [转]Ganglia 和 Nagios,第 2 部分: 使用 Nagios 监视企业集群
- 增强型for
- rsync 远程数据同步工具详解
- struts1x与spring2.5集成主要步骤
- 几条mysql命令
- 腾讯微博 邀请码
- jdbc链接mysql,access和oracle例子
- oracle实例名、数据库名与服务名的理解
- firefox&java console
- Ajax (部分二:prototype.js代码后半部分)自己做的,总结页面向后台传Form值、单个值和后台向前台传一个或是一组值
- Spring定时器
- 说不玩但是我还是玩了..