2022年SSh架构详解 .pdf

上传人:Che****ry 文档编号:35293725 上传时间:2022-08-21 格式:PDF 页数:16 大小:421KB
返回 下载 相关 举报
2022年SSh架构详解 .pdf_第1页
第1页 / 共16页
2022年SSh架构详解 .pdf_第2页
第2页 / 共16页
点击查看更多>>
资源描述

《2022年SSh架构详解 .pdf》由会员分享,可在线阅读,更多相关《2022年SSh架构详解 .pdf(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、catalogAbstract . 2 1 Introduction . 2 2 Hierarchical Web Mechanism . 3 3 Lightweight Web Application Framework . 3 4 Struts MVC Framework . 5 4.1 Struts work mechanism . 5 4.2 Views. 6 4.3 Controller . 6 4.4 Model . 6 5 Spring Framework technology . 7 5.1 Spring Framework . 8 5.2 mechanism . 9 6 Hi

2、bernate Persistent Framework . 9 7 Framework Application Analysis . 11 8 Conclusion . 12 Acknowledgments. 13 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 1 页,共 16 页 - - - - - - - - - Application of the Lightweight J2EE Framework Based on SSH Abstract The applicatio

3、n system features in small or medium-sized enterprise lie in the greater flexibility and safety high performance-price ratio. Traditional J2EE framework can not adapt to these needs, but the system application based on SSH(Struts+Spring+Hibernate) technology can better satisfy such needs. This paper

4、 analyses some integration theory and key technologies about SSH, and according to the integration constructs a lightweight WEB framework, which has integrated the three kinds of technology ,forming the lightweight WEB framework based on SSH and gaining good effects in practical applications. Keywor

5、ds:lightweight, web framework, J2EE, Struts, Spring, Hibernate 1 Introduction Generally the J2EE platform27used in large enterprise applications, can well solve the application of reliability, safety and stability, but its weakness is the price high and the constructing cycle is long. Corresponding

6、to the small or medium enterprise applications, the replace approach is the system framework of lightweight WEB, including the more commonly used methods which are based on the Struts and Hibernate. With the wide application of Spring, the three technology combination may be a better choice as a lig

7、htweight WEB framework. It uses layered structure and provides a good integrated framework for Web applications at all levels in minimizing the Interlayer coupling and increasing the efficiency of development. This framework can solve a lot of problems, with good maintainability and scalability. It

8、can solve the separation of user interface and business logic separation, the separation of business logic and database operation and the correct procedure control logic, etc. This paper studies the technology and principle of Struts and Spring and Hibernate, presenting a proved lightweight WEB appl

9、ication framework for enterprise. 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 2 页,共 16 页 - - - - - - - - - 2 Hierarchical Web Mechanism Hierarchical Web framework including the user presentation layer, business logic layer, data persistence layer ,expansion layer

10、etc, each layer for different function, respectively to finish the whole application. The whole system are divided into different logic module with relatively independent and mutual, and each module can be implemented according to different design. It can realize the system parallel development, rap

11、id integration, good maintainability, scalability. Figure 2.1 is a typical lightweight J2EE application architecture. The Web application layered structure basically is divided into three layers: the presentation layer, business logic layer, data persistence layer28. Figure 2.1 typical lightweight J

12、2EE framework 3 Lightweight Web Application Framework In the application based on B/S structure, Struts framework is used to implement the presentation layer, and Hibernate is used to lasting layer, and Spring is the core of the system. Spring integrates the MVC framework of Struts upward and integr

13、ates the 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 3 页,共 16 页 - - - - - - - - - ORM framework downward. The IOC container manages the dependencies between the various components. The development pattern combined of those three kinds technology realizes the five

14、layers structure of application system, and constructs a Web application development framework29. This frame processing shows as the figure3.1 . Figure 3.1 System Application Framework Struts framework realized MVC design patterns in the presentation layer30. In the presentation layer, the functions

15、 of controller achieved by ActionServlet and ActionMapping. ActionServlet accepts requests from the client, and each ActionMapping realizes mapping between a request and a specific Action. View realizes by the Taglib of the JSP page. Model realizes by Action and ActionForm. Action object calls busin

16、ess logic module interface and submit the response to the right View components. ActionForm component object realizes good data encapsulation for client form ,and realizes mutual support between View and Model. Business layer achieve by JavaBean class, including interfaces for Action calling. These

17、JavaBean also encapsulates Hibernate relationships. Business layer through data conversion and persistence layer to realize interaction with database resources. Persistence layer realizes by Hibernate. Hibernate convert HQL statements in Java class to SQL statements, and operate data sources with JD

18、BC driver, finishing data operation such as add ,delete, modify. Bottom is a relational database. 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 4 页,共 16 页 - - - - - - - - - 4 Struts MVC Framework 4.1 Struts work mechanism To ensure the reuse and efficiency of develo

19、pment process, adopting J2EE technology to build the Web application must select a system framework which has a good performance and been examined31. Only in this way can we ensure not wasting lots of time because of adjusting configuration and achieve application development efficiently and quickly

20、. So, programmers in the course of practice got some successful development pattern which proved practical, such as MVC and O/R mapping, etc; many technologies, including Struts and Hibernate frameworks, realized these pattern. However, Struts framework only settled the separation problem between vi

21、ew layer and business logic layer, control layer, did not provide a flexible support for complex data saving process. On the contrary, Hibernate framework offered the powerful and flexible support for complex data saving process. Therefore, how to integrate two frameworks and get a flexible, low-cou

22、pling solutions project which is easy to maintain for information system, is a research task which the engineering staff is studying constantly. Model-View-Controller (MVC) is a popular design pattern28. It divides the interactive system in three components and each of them specializes in one task.

23、The model contains the application data and manages the core functionality. The visual display of the model and the feedback to the users are managed by the view. The controller not only interprets the inputs from the user, but also dominates the model and the view to change appropriately. MVC separ

24、ates the system functionality from the system interface so as to enhance the system scalability and maintainability. Struts is a typical MVC frame32, and it also contains the three aforementioned components. The model level is composed of JavaBean and EJB components. The controller is realized by ac

25、tion and ActionServlet, and the view layer consists of JSP files. The central controller controls the action execution that receives a request and redirects this request to the appropriate module controller. Subsequently, the module controller processes the request and returns results to the central

26、 controller using a JavaBean object, which stores any object to be presented in the view layer by including an indication to module views that must be presented. The central controller redirects the returned JavaBean object to the main view that displays its information. 名师资料总结 - - -精品资料欢迎下载 - - - -

27、 - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 5 页,共 16 页 - - - - - - - - - Struts focuses on reducing the coupling between performance and logic, while takes less attention to the relevance between business layer and persistence layer. Struts framework in the mechanism divided into three parts

28、: the view, controllers and models33. Struts has its own Controller, and integrate the other technology to achieve the Model layer (Model) and View layer (View). In a model layer, Struts can easily combined with data access technology, including EJB and JDBC and Object Relation Bridge. In views laye

29、r, Struts combine with JSP and XSL which are web representation layer technology. 4.2 Views View layer, which interacts with the user, is realized by JSP knowledge usually.34 Struts provided a custom tag library to use, which can interact with Model part of system very well, achieve the mapping of A

30、ctionForm in the model part through these custom tags and the encapsulation of user data. At the same time, these custom tags also provided many kinds of displaying function, such as template customizing, etc. Views are constituted by a group of JSP documents, which have not business logic code in t

31、hese JSP files. They can access model information from tag. The ActionForm Bean in Struts framework as a part of view, encapsulating form information and sending between view and controller. 4.3 Controller Controller, which accepts the request of user, consists of Action Servlet and Action Mapping o

32、bject. The core is an object of Servlet ActionServlet34. Controller is implemented by ActionServlet and Action class. ActionServlet is the central controller in Struts framework, processing the request and transmitting to the corresponding Action components according to the configuration file struts

33、-config.xml. Action is the adapter between user requests and business logic, responsible for the apparent instruments between the method, calling model and updating the state of the model, and help control application process. 4.4 Model 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理

34、 - - - - - - - 第 6 页,共 16 页 - - - - - - - - - Model layer, which achieves the business logic of system34, offered the Action and Action From object for model part. Action processor object encapsulates the material processing logic and business calling logic modules, also submitted the request to the

35、 proper view component to generate a response. Action From component object can describe the data of client form by defining properties. Model represents the state of application and the logic of business, which is charge of accessing and updating persistent data, and it is the most important part o

36、f application. However in the framework of Struts has not provide methods or components for the design. In practical applications, the models achieve through by JavaBean, EJB or Web service. This frame processing shows as the figure4.1 . Figure 4.1 Component Structure Figure of Struts Framework 5 Sp

37、ring Framework technology Spring is a lightweight J2EE application development framework35, which uses the model of Inversion of Control(IoC) to separate the actual application from the Configuration and dependent regulations of the application. Committed to J2EE application at all levels of the sol

38、ution, Spring is not attempting to replace the existing framework, but rather “welding ” the object of J2EE application at all levels together 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 7 页,共 16 页 - - - - - - - - - through the POJO management. In addition, develo

39、pers are free to choose Spring framework for some or all, since Spring modules are not totally dependent. As a major business-level detail, Spring employs the idea of delay injection to assemble code for the sake of improving the scalability and flexibility of built systems. Thus, the systems achiev

40、e a centralized business processing and reduction of code reuse through the Spring AOP module. 5.1 Spring Framework The Spring Framework is an open source application framework for the Java platform39. Spring is a lightweight J2EE application framework, both a AOP framework and the IoC containers. C

41、entral to the Spring Framework is its Inversion of Control container, which provides a consistent means of configuring and managing Java objects using callbacks. The container is responsible for managing object life cycles: creating objects, calling initialization methods, and configuring objects by

42、 wiring them together. In many cases its not necessary to use the container when using other parts of the Spring Framework, although using it will likely make an application easier to configure and customize. The emergence of Spring framework integrated versatile special framework into coherent over

43、all framework. By combining the advantages of Struts and Hibernate, Spring framework seamless integrated the other view framework easily, enabled to choose and use a module in a certain layer according to necessary, offered a unified interface for different data access technology, conveniently achie

44、ved the bean assembly behavior by adopting IOC (inverse of control) and implement business management by providing a simple AOP. The integration framework is listed in fig5.1. 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 8 页,共 16 页 - - - - - - - - - Fig.5.1 Spring

45、integrating framework 5.2 mechanism The Spring container provides a consistent mechanism to configure applications and integrates with almost all Java environments, from small-scale applications to large enterprise applications. The following diagram represents the Spring Framework Architecture. The

46、 use of spring framework make the J2EE hierarchical structure for business logic business layer separate data persistence layer from business logic business. Spring charge of the business logic and Hibernate charges of the data access .So it makes the hierarchical structure clearer, and facilitates

47、system maintenance and expansion. 6 Hibernate Persistent Framework Hibernate is a kind of open source framework with DAO design patterns to achieve mapping(O/R Mapping) between object and relational database40. During the Web system development, the tradition approach directly interacts with the dat

48、abase by JDBC .However, this method has not only heavy workload but 名师资料总结 - - -精品资料欢迎下载 - - - - - - - - - - - - - - - - - - 名师精心整理 - - - - - - - 第 9 页,共 16 页 - - - - - - - - - also complex SQL codes of JDBC which need to revise because the business logic slightly changes. So, whatever development o

49、r maintain system are inconvenient. Considering the large difference between the object-oriented relation of java and the structure of relational database, it is necessary to introduce a direct mapping mechanism between the object and database, which this kind of mapping should use configuration fil

50、es as soon as possibility, so that mapping files will need modifying rather than java source codes when the business logic changes in the future. Therefore, O/R mapping pattern emerges, which hibernate is one of the most outstanding realization of architecture36. It encapsulates JDBC with lightweigh

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 教育专区 > 高考资料

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁