SSH框架整合

SSH框架整合

步骤一、导入所需要的jar包
Hibernate

 

 

 

 

 

 

Struts2

 

 

Spring:基础包:4+2

 

 

测试

 

 

整合web项目

 

 

aop

 

 

JDBC

 

 

步骤二、Spring整合Struts2

1、在web.xml里配置struts2

 

 

2、在struts.xml里配置struts2

 

 '3、在web.xml里配置spring

 

 

步骤三、spring整合struts2

1、在strus.xml里加入struts2常量配置

 

 

2、在struts.xml里配置由Action对象

 

 

3、在applicationContext.xml里配置action路径

 

 

步骤四、Spring整合Hibernate

整合原理:由spring管理Hibernate中sessionFactory对象

 

 

方式1: 在applicationContext.xml 配置hibernate原生文件(简单)

 

 

hibernate.cfg.xml配置如下:

 

 

 

 

方式2: 在applicationContext.xml 里配置hibernate信息

 

 

步骤五、Spring整合c3p0连接池

1、在applicationContext.xml 配置c3p0数据源

 

 

2、在applicationContext.xml 配置sessionFactory

 

 

步骤六、Spring整合aop事务

1、在applicationContext.xml配置事务管理器

 

 在applicationContext.xml配置dao和service

 

 2、在applicationContext.xml里配置事务

 

 

在applicationContext.xml 里打开注解事务开关

 

 

 

 

3、在web.xml扩大session作用范围

 

 

更多java、大数据学习面试资料,请扫码关注我的公众号:

 

 

posted @ 2021-06-06 00:02  大数据同盟会  阅读(103)  评论(0)    收藏  举报