- 各個框架的作用:
- Spring作爲bean對象的管理容器(IOC)
- Struts2 作爲核心web控制器
- Hibernate作爲處理數據庫的ORM組件
- ssh詳細配置步驟:
- 1、 定義數據庫連接屬性文件
- 2、 在web.xml中配置log4j日誌;spring上下文加載路徑以及監聽接 口類;struts配置及映射
- 3、 在spring applicationContext.xml文件中引入數據庫屬性文件
- 4、 配置數據源
- 5、 配置SessionFactory注入數據源
- 6、 配置事務管理
- 7、 配置數據庫事務處理屬性
- 8、 配置事務aop攔截(事務切面)
- 9、 定義配置 dao,service,action及其依賴關係
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:com/ssh/jd/conf/spring/applicationContext.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>
classpath:com/ssh/jd/conf/log4j.properties
</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
</listener>