【Spring】Spring+Struts2+Hibernate3整合(十七)


即:

SpringStruts整合

SpringHibernate整合

 

需求:

JSP页面显示员工信息  (查询)

 

 

整合步骤:

1) 引入SSH Jar文件

Struts 核心jar

Hibernate 核心jar

Spring

Core  核心功能

Web  web模块支持

Aop   aop支持

Orm   hibernate支持

Jdbc/tx  jdbc支持包、事务相关包

 

2)配置

Web.xml

初始化struts功能、spring容器

Struts.xml   配置请求路径与映射action的关系

Spring.xml  IOC容器配置

bean-base.xml     【公用信息】

bean-service.xml

bean-dao.xml

bean-action.xml

 

3)开发

Entity/Dao/service/action

Bean-base.xml



 










 








org.hibernate.dialect.MySQLDialect
true
update





classpath:cn/itcast/entity/*.hbm.xml



















     


 

 

Struts.xml(Spring整合的时候,acitonclass应该写springbean的名称)



 

 

 


/index.jsp

 

 


 

 

Web.xml






OpenSessionInView
org.springframework.orm.hibernate3.support.OpenSessionInViewFilter


OpenSessionInView
*.action

 


struts2
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter


struts2
/*

 


contextConfigLocation
classpath:bean*.xml


org.springframework.web.context.ContextLoaderListener

 

index.jsp



 

你可能感兴趣的:(------,【Spring】,Spring)