- 浏览: 1206762 次
- 性别:
- 来自: 深圳
文章分类
- 全部博客 (718)
- HTML (13)
- JS基础 (23)
- JS应用 (40)
- AJAX (6)
- JSP相关 (12)
- JAVA基础 (52)
- JAVA应用 (74)
- APPLET (11)
- SWING\RCP (2)
- JAVA反射 (6)
- 设计模式 (26)
- 数据库设计 (20)
- Struts (35)
- Struts2 (12)
- Spring (22)
- Hibernate (45)
- Ibatis (18)
- mybatis (3)
- SSH (8)
- UML (5)
- WebService (3)
- XML (16)
- Log4j (7)
- WEB容器 (26)
- 数据结构 (36)
- Linux (34)
- Ruby on Rails (1)
- 其它技术 (27)
- IDE配置 (15)
- 项目实战 (2)
- Oracle (69)
- JAVA报表 (7)
- Android学习 (2)
- 博客链接 (1)
- 网络基础 (1)
- WEB集群 (1)
- .Net开发 (11)
- PB (4)
- 系统构建 (15)
最新评论
-
jnjeC:
牛逼啊哥们,讲得太好了
Maven仓库理解、如何引入本地包、Maven多种方式打可执行jar包 -
九尾狐的yi巴:
很好 感谢!
Itext中文处理(更新版) -
luweifeng1983:
有用的,重启一下嘛。
设置eclipse外部修改文件后自动刷新 -
Master-Gao:
设置了也不管用,怎么破呢?
设置eclipse外部修改文件后自动刷新 -
aigo_h:
锋子还有时间写博客,还是很闲哈!
Add directory entries问题
我们在Struts中在action类中调用Model层组件进行业务逻辑操作。那么有了spring后,我们一般要使用ioc的依赖注入获得bean,比如说现在们应该可以在action类中通过spring ioc 获得Dao Bean,再调用Dao Bean中的方法。
配置过程: 一、配置struts *新建web项目,加入struts相关类库,及jstl.jar和standard.jar *修改web.xml,加入ActionServlet *拷贝tld文件及struts-config.xml文件,validation.xml文件到WEB-INF目录 *拷贝资源文件MessageResources.properties到src目录 二、配置spring *拷贝spring.jar,aspectj下的两个jar,common-loging.jar,log4j.jar到lib目录,如果包有重复,尽量用最新版本。 *拷贝spring的配置文件applicationContext.xml和log4j.properties到src目录 三、创建jsp,formBean,action等 四、创建UserDao,UserDaoImpl类,并在LoginAction中调用。测试在没有使用spring的时候结果是否正确。 五、下面我们要将spring的配置文件与web.xml关联起来。 可以到spring源代码的事例jpetStore项目中查看web.xml 拷贝到我们项目中的web.xml中: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/dataAccessContext-local.xml /WEB-INF/applicationContext.xml</param-value> <!-- <param-value>/WEB-INF/dataAccessContext-jta.xml /WEB-INF/applicationContext.xml</param-value> --> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 我们项目中使用如下: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext-*.xml,classpath*:applicationContext-*.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> 表示先从WEB-INF下找,如果找不到就到src目录下找applicationContext.xml 六、取到ApplicationContext实例,在LoginAciton中有取的实现代码 WebApplicationContext wac = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext()); UserDao userDao = (UserDao)wac.getBean("userDao"); 注意别忘了在spring配置文件中加入userDao的定义 测试结束。
- spring_struts_1.rar (6.7 MB)
- 下载次数: 5
发表评论
-
spring 3 和mybatis 3集成,并用junit4进行测试
2011-11-04 14:01 1428转:spring 3 和mybatis 3集成,并用junit ... -
java.lang.ClassNotFoundException: org.apache.commons.dbcp.BasicDataSource的解决方法
2011-11-03 16:17 2682用Myeclipse开发struts时,配置struts-co ... -
Strut2+Spring整合框架搭建
2011-11-02 22:19 1051参考:http://lukuijun.iteye.com/bl ... -
Spring+hibernate延迟加载报错解决办法之二
2010-06-29 17:28 1191在做删除操作的时候出现了org.springframework ... -
Spring+hibernate延迟加载报错解决办法之一
2010-06-29 17:25 1181我们在项目中一般都会使用Spring来管理Hibernate的 ... -
Spring项目中怎么配置log4j
2010-05-27 11:10 1556在spring项目中配置log4j http://blogg ... -
Spring与Struts集成方式三
2010-05-26 17:11 1123在集成方式一和二中我们是在web.xml中加入配置代码: & ... -
Spring与Struts集成方式二
2010-05-26 14:49 1020在集成方式一的基础上做改进: 第一种集成方案是在action ... -
Hibernate编程式事务与Spring Aop的声明式事务(spring与hibernate集成)
2010-05-24 17:15 2748采用编程式事务 事务主要分为:编程式事务和声明式事务 ... -
修改Eclipse配置,使得在配置文件中完成自动完成功能。
2010-05-24 15:10 2268在Eclipse中引入spring的配置文件applicati ... -
Spring aop 基于schema的AOP支持及JoinPoint的使用、如何使用CGLIB代理
2010-05-24 14:52 4097基于schema的aop只是将配置写到配置文件中。 代 ... -
Spring AOP 概念理解及@AspectJ支持
2010-05-20 15:56 1557为了更好的理解Spring简介一文http://quicker ... -
Spirng AOP简介
2010-05-19 17:28 2260AOP 面向切面编程(AOP)通过提供另外一种思考程序结构的 ... -
Spring Bean中的自动装配——byType
2010-05-19 17:08 1165自动装配byType即通过查找类属性在配置文件中bean中定义 ... -
Spring Bean中的自动装配——byName
2010-05-19 16:34 3125自动装配(autowire)协作者 Spring IoC容器 ... -
Spring Bean的作用域:用Spring来解决Struts中Action的单实例问题
2010-05-19 10:47 1536我们知道在Struts中Action是从map中拿出来的,是单 ... -
Spring Bean定义的继承
2010-05-19 10:36 1308现有Bean2,Bean3,Bean4,Bean5 可观察到 ... -
Spring Set注入:基本类型、List、Map、Set、Array、Date类型注入
2010-05-18 15:58 11499Spring依赖注入有两种:构造器注入与Set注入 其中以S ... -
spring 初探
2010-05-17 16:53 1222Spring核心设计思想为IOC ... -
简单DAO层示例
2010-05-14 17:30 2051在使用spring架构之前,我们怎么设计自己的DAO层的呢? ...
相关推荐
spring_struts集成spring_struts集成spring_struts集成
为了方便大家开发,特意制作了intellij环境下maven项目spring+struts集成空模板。直接导入intellij就可以用,模板下有个简单的小例子。对于学习spring+struts集成、以及希望快速开发的人来说都是不错的资源
struts spring集成 struts spring集成 struts spring集成
三大框架集成及两两集成的jar包,spring集成hibernate的jar包以及spring集成struts2的jar包已经单独打包
spring 和struts2 集成所需要的jar包
Spring集成struts以及hibernate jar包 所有的都在里面 需要的可以下载
NULL 博文链接:https://quicker.iteye.com/blog/676125
NULL 博文链接:https://quicker.iteye.com/blog/675948
通过简单了实例 并提供代码 指导初学者学会spring和struts2的集成 并实现简单的登录功能
Jpa+Spring+Struts集成步骤详解
spring struts cxf 集成
SSH集成 Struts+spring+hibernate集成SSH集成 Struts+spring+hibernate集成
struts2 spring hibernate集成 介绍上传下载。。
Spring整合集成Struts1.2最简单例子
Spring2.5.5 struts2.1.6 ibatis2.3.4 Mysql5.1 利用IntelliJ IDEA(9) 集成 所有JAR包已经包含
集成Hibernate + Spring + Struts + Mybatis,jdk 32的版本
spring+struts框架集成学习笔记和项目源码
struts spring集成原理 struts spring集成原理 struts spring集成原理
struts+spring 集成