新聞中心
SSH 環(huán)境搭建:struts2.18+spring2.5+hibernate3

創(chuàng)新互聯(lián)公司2013年至今,是專業(yè)互聯(lián)網(wǎng)技術(shù)服務(wù)公司,擁有項(xiàng)目網(wǎng)站設(shè)計(jì)、成都網(wǎng)站建設(shè)網(wǎng)站策劃,項(xiàng)目實(shí)施與項(xiàng)目整合能力。我們以讓每一個夢想脫穎而出為使命,1280元齊齊哈爾做網(wǎng)站,已為上家服務(wù),為齊齊哈爾各地企業(yè)和個人服務(wù),聯(lián)系電話:18982081108
一、SSH 環(huán)境搭建開發(fā)環(huán)境
1、Fileànewàweb project;
2、配置好TomCat;
二、SSH 環(huán)境搭建的配置structs
1、引入structs的包:
- struts2-config-browser-plugin-2.1.8.1.jar
- struts2-core-2.1.8.1.jar
- struts2-dojo-plugin-2.1.8.1.jar
- struts2-spring-plugin-2.1.8.1.jar(structs與spring整合添加的包)
2.修改WEB-INF下的web.xml,增加struts2的配置。增加代碼如下:這些配置代碼對于struts2是不變的,直接復(fù)制到web.xml即可。
struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter struts2 /*
3.添加src下添加struct.xml文件(見圖1)
注意:
若要傳入上下文信息,盡量不用,或者用type = "dispatcher"
4.在src/test包下添加action文件(見圖2)
5.添加jsp文件(見圖3)
二.Hibernate配置
1.用hibernate逆向工程,生成實(shí)體類文件和操作數(shù)據(jù)庫的dao類文件;分別復(fù)制到 test.model下,和test.service下,(不用建hibernate.cfg.xml)如下圖:(見圖4)
2.在spring的配置文件applicationContext.xml中增加以下內(nèi)容:在spring bean中注冊數(shù)據(jù)庫連接的datasouce以及sessionfactory;指定hibernate生成的實(shí)體類映射文件的具體位置;(見圖5)
3.在test.config下添加文件 serviceContext.xml 用于將 所有的set函數(shù)注冊到spring bean 里;(見圖6)
4.(見圖7)
(見圖8)
小結(jié):
SSH 環(huán)境搭建完整教程的內(nèi)容介紹完了,希望通過本文SSH 環(huán)境搭建內(nèi)容的學(xué)習(xí)能對你有所幫助!
標(biāo)題名稱:SSH 環(huán)境搭建完整教程
文章網(wǎng)址:http://fisionsoft.com.cn/article/djdsccg.html


咨詢
建站咨詢
