




下載本文檔
版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
1、咋一篇文章連個題目也沒有啊?This text analysis the mechanism of Hibernate and Struts, put forward 1 kind EE according to the J2 of the Hibernate and the Struts application development strategy.In this kind of strategy, the model layer use a Hibernate realization and see diagram and controller to then use a Struts
2、 frame a realization.So can consumedly lower the development efficiency that the Ou of code match sex and exaltation system. The key word Hibernate, Struts, the MVC, hold out for long time a layer one preface along with the Java technique of gradual mature and perfect, Be establishment business ente
3、rprise class application of standard terrace, the J2 EE terrace got substantial of development.Several technique asked for help from to include in the J2 EE norm:Enterprise JavaBean(EJB), Java Servlets(Servlet), Java Server Pages(JSP), Java Message Service(JMS).etc., development many application sys
4、tem.But, also appeared some problem in the tradition J2 the EE the application of the development the process:1)the antinomy of of data model and logic model.Currently the database of usage basically and all is relation type database, but the Java be essentially a kind of the language which face to
5、object, object at saving with read usage SQL and JDBC carry on a database operation and lowered plait distance of efficiency and system of can maintenance;2)tradition of J2 EE application much the adoption is according to the EJB heavy weight frame, this kind of frame suitable for develop a large bu
6、siness enterprise application, but usage the EJB container carry on development and adjust to try to need to be waste a great deal of time.For lowering the Ou of code to match sex, exaltation system of development efficiency, this text put forward 1 kind EE according to the J2 of the Struts frame an
7、d the Hibernate frame application development strategy. 2 datas holding out for long time layer and Hibernate is one piece according to hold out for long time layer frame, is a kind of realization object and relation of the tool which reflect to shoot(O/R Mapping), it carried on the object of the li
8、ghtweight to pack to the JDBC and make procedure member can usage object plait distance thought to operation database.It not only provided to shoot from Java to reflect of data form, but also provided a data a search and instauration mechanism.Opposite in usage JDBC and SQL to operation database, us
9、e a Hibernate ability consumedly of exaltation realization of efficiency.The Hibernate frame use allocation document of the form come to the reflect of the definition Java object and data form to shoot relation, in the meantime at more deep of level of data form of relation explanation for the relat
10、ions such as inherit of and containment etc. of Java object.Pass the usage HQL language sentence complications of relation the calculate way use the way of object description, to a large extent simplification logarithms according to of search, speed development of efficiency.Have in the Hibernate a
11、simple but keep the API of view, used for to the database mean of object performance search.Want to establish or the modification be these objects, need in the procedure carry on with them to hand over with each other, then tell Hibernate to keep.So, a great deal of pack hold out for long time turn
12、operation of business logic no longer demand write a trivial JDBC language sentence, make data last long thus the layer got biggest of simplification. 3 use the Struts realization MVC structure MVC(Model-View-Controller) is put forward by the Trygve Reenskaug, first drive application in the environm
13、ent SmallTalk-80, is many to hand over with each other with interface system of constitute foundation.According to the need of variable of the interface design, MVC hand over with each other constitute of system to resolve into model and see diagram, controller three part. Model(Model) is software p
14、rocessing problem logic at independence in outside manifestation under contents and form circumstance of inside abstract, packed the core data, logic of problem and function of calculation relation, independence in concrete of interface expression and I/O operation.See diagram(View) mean information
15、 and particular form demonstration of model data and logic relation and appearance to the customer.It acquire a manifestation information from the model, there can be many for homology of information dissimilarity of manifestation form or see diagram.The controller(Controller) is a processing the cu
16、stomer hand over with software with each other operation of, its job is control provide model in any variety of dissemination, insure a customer interface among the model of rightness should contact;It accept a customer of importation, give the importation feedback model, then realization compute mo
17、del control, is make model and see diagram to moderate work of parts.Usually 1 see a diagram rightness should a controller.Model, see separate of diagram and controller, make a model be able to have many manifestation to see diagram.If the customer pass a certain see the controller of diagram change
18、 the data of model, all other dependence in these see of data diagram all should reflection arrive these variety.When therefore and regardless occurrence what data variety, controller all would variety notice allly see diagram, cause manifestation of renewal.This is actually a kind of variety of mod
19、el-dissemination mechanism. The Struts frame is to be the item of Apache Jakarta to constitute part to publish luck to do at the earliest stage, it inheritted MVC of each item characteristic, and did according to the characteristics of J2 EE correspond of variety with expand.The Struts frame was goo
20、d to combine Jsp, Java Servlet, Java Bean, Taglib etc. technique.In the Struts, what to undertake the controller role in the MVC be an ActionServlet.The ActionServlet is an in general use control module.This control module provided a processing all HTTP claim which send out Struts of entrance point.
21、Its interception with distribute these claim to arrive correspond of action type.(these action all of type is Action son type)Moreover the control module is also responsible for using to correspond of claim the parameter fill Action Form(FromBean), and pass action type(ActionBean).Action type the bu
22、siness logic of the interview core, then interview Java Bean or adjust to use EJB.End action type control the power pass follow-up of JSP document, from JSP document born see diagram.All these control logic make use of Struts-config.xml the document come to allocation.See diagram in the Struts frame
23、 main from JSP born page completion, the Struts provide abundant of JSP label database, this is advantageous to separating performance logic and procedure logic.The model is with 1 or the form existence of several Java Bean.In the Struts, main existence three kinds of Bean, respectively BE:Action, A
24、ctionForm, EJB perhaps Java Bean. The Struts frame have no concrete definition model layer of realization, in actually the development, model layer usually is close with business logic connect with each other, and want to carry on operation to the first floor data.The underneaths introduction is a k
25、ind of development strategy, lead the Hibernate into the model layer of Struts frame, usage it to carry on a data to pack with reflect to shoot, provide hold out for long time turn of support. 4 usage Hibernate and the Struts development J2 EE application 4.1 system structure diagram 3 manifestation
26、 according to Hibernate and Struts development strategy of system structure diagram. 本文分析了Hibernate和Struts的機制,提出了一種基于Hibernate和Struts的J2EE應用開發策略。在這種策略中,模型層用Hibernate實現,視圖和控制器則用Struts框架實現。這樣可大大降低代碼的耦合性以及提高系統的開發效率。 關鍵字 Hibernate,Struts,MVC,持久層 1 引言 隨著Java技術的逐漸成熟與完善,作為建立企業級應用的標準平臺,J2EE平臺得到了長足的發展。借助于J2E
27、E規范中包含的多項技術:Enterprise JavaBean(EJB)、Java Servlets(Servlet)、Java Server Pages(JSP)、Java Message Service(JMS)等,開發出了許多應用系統。但是,在傳統J2EE應用的開發過程中也出現了一些問題:1)數據模型和邏輯模型之間的矛盾。目前使用的數據庫基本上都是關系型數據庫,而Java本質上是一種面向對象的語言,對象在存儲和讀取時使用SQL和JDBC進行數據庫操作,降低了編程的效率以及系統的可維護性;2)傳統的J2EE應用多采用基于EJB的重量級框架,這種框架適合于開發大型企業應用,但是使用EJB容器
28、進行開發和調試需要耗費大量時間。為了降低代碼的耦合性,提高系統的開發效率,本文提出了一種基于Struts框架和Hibernate框架的J2EE應用開發策略。 2 數據持久層及Hibernate Hibernate是一個數據持久層框架,是一種實現對象和關系之間映射(O/R Mapping)的工具,它對JDBC進行了輕量級的對象封裝,使程序員可以使用對象編程思想來操作數據庫。它不僅提供了從Java類到數據表的映射,也提供了數據查詢和恢復機制。相對于使用JDBC和SQL來操作數據庫,使用Hibernate能大大的提高實現的效率。Hibernate框架用配置文件的形式來定義Java對象和數據表之間的映
29、射關系,同時在更深的層面將數據表之間的關系解釋為Java對象之間的繼承及包含等關系。通過使用HQL語句將復雜的關系算法用對象的方式描述,在很大程度上簡化了對數據的查詢,加快了開發的效率。在Hibernate中有一個簡單而直觀的API,用于對數據庫所表示的對象執行查詢。要創建或修改這些對象,只需在程序中與它們進行交互,然后告訴Hibernate保存即可。這樣,大量封裝持久化操作的業務邏輯不再需要編寫煩瑣的JDBC語句,從而使數據持久層得到了極大的簡化。 3 用Struts實現MVC架構 MVC(Model-View-Controller)由Trygve Reenskaug提出,首先被應用在SmallTalk-80環境中,是許多交互和界面系統的構成基礎。根據界面設計可變性的需求,MVC把交互系統的組成分解成模型、視圖、控制器三部分。 模型(Model)是軟件所處理問題邏輯在獨立于外在顯示內容和形式情況下的內在抽象,封裝了問題的核心數據、邏輯和功能的計算關系,獨立于具體的界面表達和I/O操作。視圖(View)把表示模型數據及邏輯關系和狀態的信息及特定形式展示給用戶。它從模型獲得顯示信息,對于相同的信息可以有多個不同的顯示形式或視圖。控制器(Controller)
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 【正版授權】 ISO 18501:2025 EN Performance rating of positive displacement refrigerant compressor
- 度住宅精裝修工程合同
- 家居用品代理銷售合同
- 木工專業知識培訓課件
- 委托代理催收合同范本
- 汽車抵押合同范本簡約
- 加氣塊訂貨合同范本
- 無菌抽樣知識培訓
- 新員工質量知識培訓課件
- 控煙知識培訓課件版
- 《汽車道路照明裝置及系統》(征求意見稿)
- 殘疾人法律援助知識講座
- 小紅書食用農產品承諾書示例
- 父親角色對幼兒社會性發展的影響的研究
- 農業技術員培訓培訓課件
- AVL-CRUISE-2019-整車經濟性動力性分析操作指導書
- 勞務派遣勞務外包服務方案(技術方案)
- 幕墻層間防火封堵施工技術交底
- 地球科學課件:冰川及冰川作用
- 《扣件式鋼管腳手架安全技術規范》JGJ130-2023
- 英語電影賞析智慧樹知到課后章節答案2023年下上海杉達學院
評論
0/150
提交評論