SSH框架整合的學習總結

2021-09-24 15:25:25 字數 996 閱讀 5376

各個配置檔案:

1. 配置好資料庫連線需要的bean

org.hibernate.dialect.mysqldialect

true

true

update

thread

注意一定要導好jar包,同時要對應好所使用的jar包中的類(這個org.springframework.orm.hibernate3.localsessionfactorybean之前寫成hibernate5就一直報錯。

2. 將整個專案需要用到的bean全部寫入(這裡就寫了一部分)

類所在的位址一定要寫對!!!!!注意這裡bean是一層層注入的,sessionfactory-->usersdao-->usersservice-->useraction

3. 事務管理(暫時還不太理解)

注意pointcut後面的命名:

struts.xml檔案:照常寫就好。

可以新增這句設定為開發者模式,便於**除錯。

web.xml檔案:

新增下面兩句,其餘均和struts2相同!

contextconfiglocation

org.springframework.web.context.contextloaderlistener

配置檔案完。。。寫配置檔案一定要細心!!!!

struts2和spring整合時需要struts2-spring-plugin-2.3.24.jar!!這個jar包使action由spring建立,而非struts2使用自身工廠建立。

(未完待續...,歡迎指正)

SSH框架整合

首先將 spring 加入到web容器在 web.xml 中加入 context param param name contextconfiglocation param name 說明 為了管理方便設定了多個 spring 的配置檔案 context param 然後加入 spring liste...

SSH框架整合

版本 struts 2.3.30,spring framework 3.2.10.release,hibernate distribution 3.6.0.final 一 引入相關jar檔案 二 struts.xml配置 apache software foundation dtd struts c...

SSH框架整合

記事本手打 正確率略低 1.匯入jar包 name cn.com.product table product name pid column pid class native id name pname column pname property name page column page prop...