Hibernate relieves the developer from 95 percent of common data persistence related programming tasks, compared to manual coding with SQL and the JDBC API. And it can integrate various Web server or application server, and nearly support all popular databases server.
4.The Integration of Struts and Hibernate
In 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.
4.1. Flow of Framework
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 URL. 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.
RequestProcessor 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. Thereby, ActionServlet is transmitted to the appointed resource of ActionForward, which means the correct view chosen is shown to users.
4.2. Systematic Structure of the Integration Framework
The 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 pided 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.
- 上一篇:电子商务网站的设计英文文献和中文翻译
- 下一篇:宽带互联网服务英文文献和中文翻译
-
-
-
-
-
-
-
杂拟谷盗体内共生菌沃尔...
中考体育项目与体育教学合理结合的研究
河岸冲刷和泥沙淤积的监测国内外研究现状
乳业同业并购式全产业链...
电站锅炉暖风器设计任务书
十二层带中心支撑钢结构...
酸性水汽提装置总汽提塔设计+CAD图纸
大众媒体对公共政策制定的影响
当代大学生慈善意识研究+文献综述
java+mysql车辆管理系统的设计+源代码