Research of Structure Integration based on Struts and Hibernate 1.Introduction Following the rapid development of network technique, the distributed enterprise Web application technique is becoming mature day by day. With the extensive application of Java technology, the Web application system of Java 2 Platform Enterprise Edition (J2EE) is accepted by the great majority companies gradually for its stratification and the independence of platform. J2EE has been testified to be a trusting enterprise technique of software development and supported by many important firms of IT industry. But J2EE has some disadvantages, for instance, the high price, long periods and complex realization which bring from Enterprise Java Bean(EJB).
Now Struts has already become the most popular framework based on Java language because of bringing the excellent layer pision to Web application. At present, a few large-scale firms embed Struts in J2EE of the assembly development implement. But in the model part of Struts the realization of the interaction between system and database is not ideal. While Hibernate provides the mapping mechanism from Java class to datasheet, the data inquiring and recovering mechanism and so on, and it realizes the object permanence of data layer. Hibernate gets rid of the disadvantages of operating the relational database in system directly.37891
Therefore, adopting the multi-layer framework of integration based on Struts and Hibernate can bring the both merits to play sufficiently which solves some disadvantages of the traditional J2EE well.
2.Struts Framework Based on MVC
In 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 system's stratification and the loose coupling of three layers or multilayer, and it is a realization way of orienting dynamic content. The MVC mode pides 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.
3.Hibernate Framework Based on ORM
Working 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 Language (SQL) statements to map an object model's data representation to a relational data model and its corresponding database schema.
3.1. Introduction of Hibernate
Hibernate 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)), 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 don’t 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. java Struts和Hibernate的结构整合英文文献和中文翻译:http://www.youerw.com/fanyi/lunwen_36765.html