Struts+Spring+Ibatis整合框架搭建配置文檔_第1頁
Struts+Spring+Ibatis整合框架搭建配置文檔_第2頁
Struts+Spring+Ibatis整合框架搭建配置文檔_第3頁
Struts+Spring+Ibatis整合框架搭建配置文檔_第4頁
全文預(yù)覽已結(jié)束

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

1、Struts + Spring +ibatis 整合開發(fā)步驟: .添加 Spring、Struts 框架對 web.xml 文件的修改 添加 Spring框架 在 web.xml中引入 Spring 配置文件(注意:applicationContext.xml 文件的路徑) contextConfigLocation /WEB-INF/conf/applicationContext.xml / param-value / context-param context servlet-class org.springframework.web.context.ContextLoaderServle

2、t / servlet-class servlet-class org.apache.struts.action.ActionServlet / servlet-class config /WEB-INF/conf/struts-config.xml / welcome-file-list2. / param-name servlet-name load-on-startup i / load-on-startup 3. 4. 添加 Struts 框架 在 web.xml中引入 Spring 配置文件(注意: struts-config.xml 文件的路徑) action / servlet-

3、name param-name param-value param-name param-value debug 3 param-name detail 3/ / init-param load-on-startup 0/ load-on-startup servlet-mapping action / servlet-name 5. url-pattern / servlet-mapping web.xml 自動添加的 *.do jsp文件的訪問路徑) /WEB-INF/jsp/emp.jsp / welcome-file 二、對 Spring 配置文件 applicationContext

4、.xml 文件的修改 1. 配置 JDBC 數(shù)據(jù)源驅(qū)動文件 perties (服務(wù)器、端口、賬戶、密碼因具體情況而定) MySql : jdbc.driver= com.mysql.jdbc.Driver jdbc.url= jdbc : mysql:/localhost:3306/test jdbc.username= root jdbc.password= admin Oracle: jdbc.driver= oracle.jdbc.driver.OracleDriver jdbc.url= jdbc : oracle:thin::1521:orcl jd

5、bc.username= scott jdbc.password= tiger MS Sql Server : jdbc.driver= com.microsoft.jdbc.sqlserver.SQLServerDriver jdbc.url= jdbc:microsoft:sqlserver:/localhost:1433;DatabaseName=mssql jdbc.username= sa jdbc.password= sa 2. 將 JDBC 驅(qū)動源文件部署到 ApplicationContext.xml 配置文件中 bean id = propertyConfigurer cla

6、ss = org.springframework.beans.factory.config.PropertyPlaceholderConfigurer /WEB-INF/conf/perties 3. 將 Data Source 配置到 ApplicationContext 文件中 $jdbc.driver $jdbc.url $jdbc.username $jdbc.password 1 25 5 4. 在 Spring 配置中注入 3 中的 datasource 數(shù)據(jù)源 5.引入具體的 sql 語句配置文件(注意: sqlMapConfig.xml 文件的路徑) /WEB-

7、INF/conf/ sqlMapConfig .xml 6.注入操作數(shù)據(jù)庫的 dao (empDao是舉例) 三.對 Struts 配置文件struts-config.xml 文件的修改 1. 填寫 form-bean 2. 填寫 action-mapping 3. 填寫 message-resource 和 plug-in (注意:action-servlet.xml 文件路徑) 4. Spring 與 Struts 相對用的配置 applicationContext .xml bean name =/queryEmp class property name =empService ref

8、bean =empService 附一:配置文件示意圖如下 3 . WebRoot + & META-IBF -I - 13 conf action-servlet.xml appli cticnCQntext.xml jdtc. pr er ties sql-map-coiifixml struts-confi g. 附二:包結(jié)構(gòu) A 0 wwbgsi 日. com. web. E JB p -,action T EmpActi on. jiva 白出dao B- SB 沖 B U k u ;K sup.iml 國“ |j EmpD&o. Java + EnpDaAliipl. B 母 fem +: 7 EnpForm. :B Hi model 3 J E

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論