Skip to content
ghzhwatch edited this page May 21, 2020 · 37 revisions

SSH

Groups:

  1. 9-up
  2. Seven Dwarves

Overview

SSH framework

Official statement: SSH is an integrated framework of struts+spring+hibernate and a popular open source framework for web applications.

SSH is not a framework, but a close combination of multiple frameworks (Struts, Spring, and Hibernate) to build flexible, easy-to-extend multi-tier Web applications.

The Java EE architecture is roughly divided into the following levels:

Physical layer (POJO layer). Data access layer (DAO layer). Business logic layer (Service layer). Controller layer (Controller layer). Presentation layer (View layer). In terms of function, the system of SSH framework can be divided into four layers: presentation layer, business logic layer, data persistence layer and domain module layer (entity layer).

The business process of SSH framework

The basic business process of building the system by SSH is as follows:

  1. In the presentation layer, the interactive interface is firstly realized through the JSP page, which is responsible for sending the Request and receiving the Response. Then, Struts delegates the Request received by the ActionServlet to the corresponding Action according to the configuration file (struts-config.xml).

  2. In the business layer, the Spring IoC container that manages the service component is responsible for providing the Action with the business Model component and its collaborating object data processing (DAO) component to complete the business logic, as well as container components such as transaction processing and buffer pools to improve system performance and ensure data integrity.

  3. In the persistence layer, it relies on Hibernate's object mapping and database interaction to process the data requested by DAO components and return the processing results.

Using the above development model, not only the view, controller and model are completely separated, but also the business logic layer and the persistence layer are separated. In this way, no matter how the front end changes, the model layer only needs a few changes, and the changes of the database will not affect the front end, greatly improving the reusability of the system. Moreover, due to the small coupling degree between different layers, it is beneficial for team members to work in parallel, which greatly improves the development efficiency.

The advantages of the SSH framework

  1. A typical three-tier architecture embodies the idea of MVC(Model, View and Controller), which can relieve developers of the burden and effort of re-establishing solutions to complex problems, facilitate agile development of new requirements, and reduce the development time cost

  2. Good scalability. The mainstream technology of SSH has a strong user community to support it, so the framework is highly extensible and pluggable for special applications to avoid most functions that cannot be realized due to technical problems

  3. Good maintainability, the business system often has new requirements, the three-tier architecture can minimize the risk of requirement modification due to the reasonable separation of the logic layer and the presentation layer. With the popularity of new technologies or the aging of the system, the system may need to be reconstructed, and the success rate of SSH architecture reconstruction is much higher than other architectures

  4. Excellent decoupling, few software products demand is completely right from the start of a fixed customer software requirements, is with the deepening of the software development process, keep clear, therefore, often meet with software development to a certain extent, because the customer changed demand for software, making the realization of the software had to change the SSH three-tier architecture, control depends on the business logic layer, but not with any specific business logic component coupling, only with the interface coupling;Similarly, the business logic layer relies on the DAO layer and is not coupled to any specific DAO components, but is interface-oriented programming that implements the software in this way, even if one part of the software changes, the rest does not.

The significance of the SSH framework

The use of the framework can greatly shorten the development cycle of large-scale systems and improve the development quality. For traditional Java programming, comparing the object-oriented technology based on the class library, the framework has sealed these codes for us. In the development process, as long as we can call these already written classes or interfaces to implement the methods, or rewrite the methods to make them Our work services can save our development cycle. Make the work more efficient and orderly.

Application framework is more inclined to software reuse for professional fields. With the continuous development of software industry, various systems become more complex, and the fields involved are more and more broad. If every new system is received and re developed, it will be a very long process, reducing the work efficiency. If the staff in the team write their own, due to the different working styles of each person and the different ways of writing code, the project will become disorderly, and if there is a problem in the system, it is even more difficult to maintain it again. Therefore, SSH framework can make developers write programs as consistent as possible, which can reduce the maintenance complexity caused by different working habits.

The disadvantages of the SSH framework

  1. Hibernate diadvantages: (1) hibernate learning cost is relatively high. (2) not suitable for complex SQL queries. (3) it is not suitable for batch data operation.
  2. The spring disadvantages: There is a lot of code to write in JSP, the controller is too flexible, and it lacks a common controller.
  3. The Struts disadvantages: (1) dividing the control layer in MVC into three parts not only makes the structure clearer, but also increases the complexity of the system (2) it is inconvenient to use ActionForms for unit testing (3) it is too dependent on servlets. Struts must rely on httprequest and HttpResponse objects when handling action.

The differences between the SSH framework and the Django framework

The SSH framework uses the MVC design pattern, and the Django framework uses the MVT design pattern.But MVT is yet another design pattern similar to MVC. It is also used for implementing web interfaces and applications but in contrast to MVC, the controller part is taken care for us by the framework itself.

Django's Model layer comes with a powerful database access component, the ORM component, which eliminates the need for developers to learn other database access technologies.But SSH requires a high level of familiarity with database statements.

Clone this wiki locally