




免費(fèi)預(yù)覽已結(jié)束,剩余10頁(yè)可下載查看
下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
畢業(yè)設(shè)計(jì)說(shuō)明書(shū)英文文獻(xiàn)及中文翻譯2目 錄1 Struts Framework Based on MVC12 Hibernate Framework Based on ORM32.1 Introduction of Hibernate32.2 Principle of Hibernate43 The Integration of Struts and Hibernate53.1 Flow of Framework63.2 Systematic Structure of the Integration Framework61 基于MVC的Struts框架82 基于ORM的Hibernate框架102.1 Hibernate介紹102.2 Hibernate標(biāo)準(zhǔn)113 Struts和Hibernate的整合123.1 框架的工作流程123.2整合框架的系統(tǒng)結(jié)構(gòu)13II1 Struts Framework Based on MVCIn the traditional Web application, Java Server Pages(JSP) pages are responsible for handling all things, for example, receiving requests, executing business logics, choosing the next page. These complicated things may lead to chaos of JSP pages codes and be harmful for the extension and maintenance of pages. The Model-View-Controller (MVC) mode separates the programming codes into three different areas, which has solved the above problem. MVC can realize J2EE application systems stratification and the loose coupling of three layers or multilayer, and it is a realization way of orienting dynamic content. The MVC mode divides application into three core components of Model, View and Controller.Struts is a realization of MVC. It is an open source Web application framework and uses Servlet and JSP marks that belong to the J2EE norm as a part of the realization. Struts inherits MVC characteristics and realizes some corresponding changes and extension according to J2EE traits. Struts separates Java codes of JSP by Java Bean and Action class to be the MVC mode, transmits data among the three partitions of Model, View and Controller, demonstrates the connection between various classes and JSP pages by configuration files finally and it intends to realize the separation of presentation layer, business layer and data layer. The Struts structure is shown in Figure 1.The Model contains the business logic that exchanges data with a persistence layer. The View is in charge of producing what is directly visible to the user, e.g. web pages. The Controller is the layer that receives requests from clients, determines what business logic takes place and where to go next. In the Struts framework, the Model uses Java classes for the business logic. The View can be implemented with JSP and the Tag lib of Struts. The Controller is a J2EE component known as Servlet, more specifically an ActionServlet object, which determines what or when logic gets executed and where the control should get directed.第 2 頁(yè) 共 10 頁(yè)Figure 1. Struts structure 第 2 頁(yè) 共 10 頁(yè)2 Hibernate Framework Based on ORMWorking with both the object-oriented software and the relational database is a complicated task with Java Database Connectivity (JDBC) because there is mismatch between how data is represented in objects versus relational database. So with JDBC, developers have to write pure the Structured Query Languag (SQL) statements to map an object models data representation to a relational data model and its corresponding database schema.2.1 Introduction of HibernateHibernate is a flexible and powerful Object-Relational Mapping (ORM) solution to map Java classes to database tables. It is a powerful, high performance object-relational persistence and query service. Hibernate allows developers to express queries in its own portable SQL extension (Hibernate Query Language (HQL)3, as well as in native SQL, or with an object-oriented criteria and example Application Programming Interface(API). Hibernate itself takes care of this mapping using XML files so developers dont need to write code for this.Hibernate is an open source and it is free to use for both development and production deployments, which is a bridge between Java application and relational database and takes charge of mapping between Java objects and relational data. The inside of Hibernate packs the operation of accessing database by JDBC, which provides API of object-oriented database access to upper layer application. So developers can use the object programming thought to operate database sufficiently, caring for the bottom database structure unnecessarily.Hibernate relieves the developer from 95 percent of common data persistence related programming tasks, compared to manual coding with SQL and the JDBC API4. And it can integrate various Web server or application server, and nearly support all popular databases server.第 0 頁(yè) 共 10 頁(yè)2.2 Principle of HibernateFigure 2. Hibernate systematic structureAs shown in figure 2, Hibernate lies in the middle layer that is between application and database .In the provided persistent service, Hibernate maps class to rows of datasheet by properties and mapping files of class (mapping.xml) itself. Application interacts with database by Persitstent Object (PO) to handle data directly.第 5 頁(yè) 共 10 頁(yè)3 The Integration of Struts and HibernateIn the open source frameworks, for the presentation part, Tapestry has the powerful and natural combination of pages, its document is too conceptional to benefit programming. And its learning curve was too steep and so on. For the logic part, Spring has a good integration function, but there is a lack of public controller. And EJB depends on the EJB containers, at the same time, it is realized complicatedly. While Struts has been applied extensively because of its advantages.At present, most of systems apply the relational databases mainly, while Java is an object-oriented language essentially. In Model part of Struts framework application, using SQL and JDBC to operate databases when storing and fetching objects reduces programming efficiency and the systematic maintainability. Traditional J2EE-based application applies heavyweight framework based on EJB that adapts to the large enterprise development, while development and debugging by EJB container need to consume a plenty of time and high price. EJB3 improves the disadvantages of original EJB, but its application is not mature yet.Hibernate can substitute Container-Managed Persistence (CMP) to accomplish heavy responsibility of permanence in J2EE framework of applying EJB.In a word, Hibernate can resolve the difficulties coming from using traditional CMP, JDBC and Data Access Object(DAO) in a technological development. For reducing the coupling of code and raising systematic development efficiency, this paper suggests J2EE application development tactics based on Struts and Hibernate.The Struts design shows the MVC framework sufficiently, which all control flows need a configuration file (Struts-config.xml) to manage, and which is convenient to maintain. The integration of Struts and Hibernate is that Hibernate solves the model layer of Struts, which makes developers operate Java objects instead of database. The integration shows the object-oriented thought sufficiently and solves some problems of the database operation in traditional J2EE well.第 2 頁(yè) 共 10 頁(yè)3.1 Flow of FrameworkThe flow of integration framework based on Struts and Hibernate is shown in Figure 3. At first, users send Http requests by Browser, then Http requests are accepted by ActionServlet of the control component in business layer, then gave to RequestProcessor which gets corresponding Action from ActionMapping by request URL3. Besides, ActionForm packs JSP pages, which can make a checking to data of datasheet if it is needed, send back ActionErrors to visual pages if there are mistakes and transfer the data of pages to Action if it passes validation.Request Processor transfers the “execute” method of Action and the method transfers the business logic module. Hibernate accomplishes interaction of databases and JavaBean. The operation of processing business logic interacts with database by data permanence layer and field object layer. The “execute” method of Action will return ActionForward objects that are accepted by ActionServlet after executing.3.2 Systematic Structure of the Integration FrameworkThe EIS layer of the multi-layer J2EE systematic structure can be partitioned into the data permanence layer and the data resource layer. It means a system can be divided into five layers as a whole.Client Layer: This layer runs in the Browser of users machines and handles interaction with users, transmits and shows messages to users. J2EE platform supports different type users including HTML users, Java Applets, Java application, etc.Presentation Layer: This layer works in J2EE Web container, produces the systematic representation logic, handles users requests and makes the responses. The entire Web is built on Struts framework, in which the View component is composed of JSP/HTML pages whose data is expressed by ActionForm Bean, the Controller component is composed of ActionServlet united Struts-config.xml and Action Classes, and the Model component is realized by business logic layer.Business Logic Layer: This layer accomplishes the required business of system, provides the required business method to presentation layer. It can receive data from client programs and save them to the storage equipment after proper disposal, read data from the data storage equipment, then send them out to client programs.第 7 頁(yè) 共 10 頁(yè)This layer is composed of Business Objects (BO) such as JavaBean and session EJB.Figure 3. Flow chart of the integration framework based on Struts and Hibernate第 8 頁(yè) 共 10 頁(yè)1 基于MVC的Struts框架在傳統(tǒng)的Web應(yīng)用程序,Java服務(wù)器頁(yè)面(JSP)頁(yè)面負(fù)責(zé)處理所有的事情,例如,接收請(qǐng)求,執(zhí)行業(yè)務(wù)邏輯,選擇下一個(gè)頁(yè)面。這些復(fù)雜的事情,可能會(huì)導(dǎo)致混亂JSP 頁(yè)面編碼和有害的擴(kuò)展和維護(hù)的JSP頁(yè)面。模型-視圖-控制器(MVC)模式編程代碼分離成三個(gè)不同的區(qū)域,它已經(jīng)解決了上述問(wèn)題。 MVC可以實(shí)現(xiàn)J2EE應(yīng)用程序的系統(tǒng)的分層和三層或多層的松散耦合,它是一個(gè)實(shí)現(xiàn)的定向動(dòng)態(tài)內(nèi)容的方式。 MVC模式把應(yīng)用程序分成三個(gè)核心部件的模型,視圖和控制器。Struts是一個(gè)MVC實(shí)現(xiàn)。它是一個(gè)開(kāi)源Web應(yīng)用框架,使用Servlet和JSP標(biāo)記屬于J2EE規(guī)范的一部分實(shí)現(xiàn)。的Struts繼承了MVC的特點(diǎn)和根據(jù)J2EE性狀,實(shí)現(xiàn)一些相應(yīng)的變化和擴(kuò)展。 Struts的分離JSP的Java代碼的Java Bean和Action類是MVC模式,數(shù)據(jù)傳輸三者間的分區(qū)模型,視圖和控制器,演示各種類和JSP頁(yè)面之間的連接配置文件,終于和它打算實(shí)現(xiàn)表現(xiàn)層,業(yè)務(wù)層和數(shù)據(jù)層的分離。 Struts的結(jié)構(gòu)示于圖1。該模型包含業(yè)務(wù)邏輯交換數(shù)據(jù)持久層。查看是負(fù)責(zé)生產(chǎn)的,什么是直接對(duì)用戶可見(jiàn),例如網(wǎng)頁(yè)??刂破鲗?,接收來(lái)自客戶端的請(qǐng)求,決定哪些業(yè)務(wù)邏輯需要的地方,下一站去哪里。在Struts框架中,模型用業(yè)務(wù)邏輯的Java類。 JSP和Taglib是Struts的視圖可以實(shí)現(xiàn)。該控制器是被稱為Servlet的J2EE組件,更具體一個(gè)ActionServlet的對(duì)象,這就決定什么邏輯被執(zhí)行時(shí),應(yīng)該得到控制。第 2 頁(yè) 共 10 頁(yè)圖1.Struts結(jié)構(gòu)第 2 頁(yè) 共 10 頁(yè)2 基于ORM的Hibernate框架Java數(shù)據(jù)庫(kù)連接(JDBC),面向?qū)ο蟮能浖完P(guān)系數(shù)據(jù)庫(kù)的工作是一項(xiàng)復(fù)雜的任務(wù),因?yàn)閿?shù)據(jù)是如何表示的對(duì)象與關(guān)系數(shù)據(jù)庫(kù)之間存在不匹配。因此,使用JDBC,開(kāi)發(fā)人員必須寫(xiě)純結(jié)構(gòu)化查詢語(yǔ)言開(kāi)發(fā)(SQL)語(yǔ)句對(duì)象模型的映射數(shù)據(jù)表示關(guān)系數(shù)據(jù)模型及其相應(yīng)的數(shù)據(jù)庫(kù)架構(gòu)。2.1 Hibernate介紹Hibernate是一個(gè)靈活和強(qiáng)大的對(duì)象-關(guān)系映射(ORM)的解決方案,Java類映射到數(shù)據(jù)庫(kù)表。這是一個(gè)強(qiáng)大的,高性能的對(duì)象關(guān)系持久性和查詢服務(wù)。Hibernate允許開(kāi)發(fā)人員在其自己的便攜式SQL擴(kuò)展來(lái)表達(dá)查詢(Hibernate查詢語(yǔ)言(HQL),以及在本地的SQL,或面向?qū)ο蟮臉?biāo)準(zhǔn)和示例應(yīng)用程序編程接口(API)。Hibernate自身需要照顧這個(gè)映射使用XML文件,以便開(kāi)發(fā)人員不需要編寫(xiě)代碼。Hibernate是一個(gè)開(kāi)放源代碼和用于開(kāi)發(fā)和生產(chǎn)部署,這是一個(gè)橋梁Java應(yīng)用程序關(guān)系數(shù)據(jù)庫(kù)之間和負(fù)責(zé)的Java對(duì)象和關(guān)系數(shù)據(jù)之間的映射,它是免費(fèi)的。里面的Hibernate包JDBC,它提供了面向?qū)ο蟮臄?shù)據(jù)庫(kù)訪問(wèn)到上層應(yīng)用的API訪問(wèn)數(shù)據(jù)庫(kù)的操作。因此,開(kāi)發(fā)人員可以使用對(duì)象編程思想,充分操作數(shù)據(jù)如圖2所示,休眠在于中間層和應(yīng)用程序之間提供了持續(xù)的服務(wù),Hibernate的映射類類的屬性和映射文件(mapping.xml中)本身的數(shù)據(jù)表行database。應(yīng)用程序與數(shù)據(jù)庫(kù)由持久化對(duì)象(PO)直接處理數(shù)據(jù)。庫(kù),關(guān)懷不必要底層數(shù)據(jù)庫(kù)結(jié)構(gòu)。Hibernate的減輕了開(kāi)發(fā)人員常見(jiàn)的數(shù)據(jù)持久化相關(guān)的編程任務(wù)的95,比手動(dòng)編碼的SQL和JDBC API。它可以集成各種Web服務(wù)器或應(yīng)用服務(wù)器,幾乎支持所有流行的數(shù)據(jù)庫(kù)服務(wù)器。第 2 頁(yè) 共 10 頁(yè)2.2 Hibernate標(biāo)準(zhǔn)圖2.Hibernate系統(tǒng)結(jié)構(gòu)如圖2所示,休眠在于中間層和應(yīng)用程序之間提供了持續(xù)的服務(wù),Hibernate的映射類屬性和映射文件(mapping.xml中)本身的數(shù)據(jù)表行database。應(yīng)用程序與數(shù)據(jù)庫(kù)由持久化對(duì)象(PO)直接處理數(shù)據(jù)。第 2 頁(yè) 共 10 頁(yè)3 Struts和Hibernate的整合在開(kāi)源框架,用于演示的一部分,代理路由算法具有強(qiáng)大能自然的和網(wǎng)頁(yè)結(jié)合,其文件是太概念性受益編程的。其學(xué)習(xí)曲線太陡等。Spring的邏輯部分,具有良好的整合功能,但是缺乏公眾控制器。和EJB 依賴于EJB容器,在同一時(shí)間,實(shí)現(xiàn)復(fù)雜。雖然Struts已經(jīng)被廣泛應(yīng)用,因?yàn)樗膬?yōu)勢(shì)。目前,大多數(shù)的系統(tǒng)關(guān)系數(shù)據(jù)庫(kù)應(yīng)用為主,而Java是一種面向?qū)ο蟮恼Z(yǔ)言本質(zhì)。在Struts框架的應(yīng)用程序
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 羊只轉(zhuǎn)讓協(xié)議書(shū)
- 電費(fèi)結(jié)算協(xié)議書(shū)
- 簽分手費(fèi)協(xié)議書(shū)
- 第三終端協(xié)議書(shū)
- 退稅墊資協(xié)議書(shū)
- 送教結(jié)對(duì)協(xié)議書(shū)
- 藥店共建協(xié)議書(shū)
- 美油貿(mào)易協(xié)議書(shū)
- 電子廠用工合同協(xié)議書(shū)
- 茶葉團(tuán)購(gòu)協(xié)議書(shū)
- 布袋除塵器檢修方案
- 《運(yùn)動(dòng)處方》課件-糖尿病人群運(yùn)動(dòng)處方
- 2025年湘美版(2024)小學(xué)美術(shù)一年級(jí)下冊(cè)(全冊(cè))每課教學(xué)反思(附目錄P49)
- 網(wǎng)絡(luò)技術(shù)基礎(chǔ)知識(shí)試題及答案
- (完整)公共基礎(chǔ)知識(shí)題庫(kù)及答案
- 《地形圖的判讀》同步高效課件(第1課時(shí))
- 血?dú)夥治鼋Y(jié)果判斷及臨床意義
- 2026年版廣西高等職業(yè)教育考試(新職教高考)普高生專用升高職大?!堵殬I(yè)適應(yīng)性測(cè)試》模擬試卷(第4套)
- 光伏組件銷售合同
- 《選煤基本知識(shí)》課件
- 三年級(jí)上下冊(cè)英語(yǔ)單詞表人教版
評(píng)論
0/150
提交評(píng)論