Struts2.2.3+Spring3.0.6+Hibernate3.6.7的框架整合
来源:互联网 发布:终极算法 epub 编辑:程序博客网 时间:2024/05/01 00:32
1、新建Web项目,导入包
1)Struts2.2.3.1 http://struts.apache.org/download.cgi#struts2231
需要的Jar包
2)Spring3.0.6 http://www.springsource.org/download
需要的Jar包
org.springframework.web-3.0.6.RELEASE.jar
3)Hibernate3.6.7 http://sourceforge.net/projects/hibernate/files/hibernate3/3.6.7.Final/
需要的Jar包
数据库的jar
oracle mssql mysql
2、配置
1)Web项目的配置:web.xml
struts2 spring
<!-- Spring 配置 Web整合 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 在Web项目中 启用 Struts2 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
2)Struts配置:struts.xml
<!-- Spring和Struts的整合 -->
<constant name="struts.objectFactory" value="spring"></constant>
constant
action
3)Spring配置:applicationContext.xml
bean 依赖注入
hibernate sessionFactory
<!-- 配置 hibernate的SessionFactory -->
<bean id="sessionFactory">
<property name="dataSource" ref="mysqlDataSource"/>
<property name="mappingResources">
<list>
<value>/com/insigma/pojo/Emp.hbm.xml</value>
<value>/com/insigma/pojo/Dept.hbm.xml</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
show_sql=true
</value>
</property>
</bean>
hibernate配置hibernate.cfg.xml
数据库连接池 dbcp DataBase Connection Pool
<!-- 数据库的连接池配置 -->
<bean id="mysqlDataSource" destroy-method="close">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost:3306/test"/>
<property name="username" value="root"/> <property name="password" value="123456"/>
</bean>
oracle mysql mssql db2 sybase
事务管理配置 aop (暂时不配置)
4)Hibernate配置:hibernate.cfg.xml
xxx.hbm.xml
3、搭建项目框架
com.insigma.vo XXXVO.java
com.insigma.utils MD5加密 类型转换
com.insigma.pojo XXX.java XXX.hbm.xml
com.insigma.dao.face IXXXDAO
com.insigma.dao.impl XXXDAOImpl
com.insigma.service.face IXXXService
com.insigma.service.impl XXXServiceImpl
com.insigma.action XXXAction
com.insigma.interceptor XXXInterceptor
src Struts.xml applicationContext.xml hibernate.cfg.xml
web-inf web.xml
web-inf/lib 所有的jar
- Struts2.2.3+Spring3.0.6+Hibernate3.6.7的框架整合
- 【Struts2+Spring3+Hibernate3】SSH框架整合
- struts2 spring3 hibernate3整合
- Struts2+Spring3+Hibernate3整合
- Struts2+Hibernate3+Spring3 整合
- Struts2+Spring3+Hibernate3整合
- spring3 struts2 hibernate3整合
- JavaWeb开发之SSH框架整合——Struts2+Spring3+Hibernate3三大框架的整合
- spring3.0 + hibernate3.5 + struts2的整合
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD_1.0
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD_1.1
- Struts2+Spring3+Hibernate3 SSH框架整合实现CRUD
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD_1.2
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD_1.3
- Struts2.3.4+Hibernate3.6+Spring3.0.5框架整合(新手看看)
- 【Struts2+Spring3+Hibernate3】SSH框架整合实现CRUD
- 整合Struts2+Spring3+Hibernate3三大框架实现淘宝商城
- Android入门1—开发环境搭建
- ide在线编译
- 再起java征途
- 怎样做好没有经验的需求分析?
- 如何使用sencha-touch控件显示平板上的tab界面
- Struts2.2.3+Spring3.0.6+Hibernate3.6.7的框架整合
- poj 1861
- 不要一辈子靠技术混饭吃
- 串口调试
- C#委托的3种使用
- java静态内部类
- JDK 与JRE的区别(摘录)
- 使用sencha touch控件制作list界面
- Timer技术