SSH整合步驟

2021-07-22 10:03:12 字數 801 閱讀 2254

整合步驟

1.引入jar包

2.配置檔案web.xml.struts.xml

3.建立包結構

4.兩兩整合:struts2整合spring

建立頁面:建立儲存商品的頁面

5.編寫action,service,dao

6.配置action,service和dao

自動注入時候:

使用struts自己生成adction時候:

此時的struts.xml:

當使用spring來管理時候:需要加乙個adction配置

此時struts.xml發生變化:

!!!!!!!!此處class發生變化

7.spring整合hiberate

步驟七:建立資料庫

步驟8:建立對映檔案:***x.hbm.xml

建立屬性檔案:jdbc.properties

jdbc.driverclass=com.mysql.jdbc.driver

jdbc.url=jdbc:mysql://localhost:3306/ssh

jdbc.username=root

jdbc.password=123

org.hiberate.dialect.mysqldialect

步驟8:

使用hiberate模版:直接繼承

public class productdao extends hibernatedaosupport

}步驟9:事務管理

開啟註解事務:

在業務上service

@transactional

SSH框架整合步驟

struts2 org.apache.struts2.dispatcher.filterdispatcher struts cleanup org.apache.struts2.dispatcher.actioncontextcleanup struts.xml檔案 login.jsp succes...

SSH整合開發步驟詳解

這篇博文主要敘述了ssh的整合開發步驟,是對前段時間ssh專案的乙個簡單總結。1.加入spring 1 新建乙個動態的web工程,加入spring相關的jar包 2 配置 web.xml 檔案,主要配置啟動ioc容器的listener 3 加入spring的配置檔案。因為配置檔案比較多,所以在當前w...

ssh整合具體步驟

struts2 spring hibernate是j2ee的最新流行框架。本篇是我搭建這個框架的經驗總結。本方案採用自底向上 hibernate spring struts2的方式進行整合。具體步驟如下 1.通過myeclipse嚮導,匯入實現hibernate3.2功能 生成會話工廠和hibern...