Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the re-layering based on SSH development architecture?

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

In this issue, the editor will bring you what the re-layering based on SSH development architecture is like. The article is rich in content and analyzed and described from a professional point of view. I hope you can get something after reading this article.

In the development of modern enterprises, more and more multi-tier architecture design patterns are introduced. Struts+Spring+Hibernate (hereinafter referred to as SSH) is one of them, SSH architecture is currently very popular architecture, many financial, telecommunications projects, large portals have chosen this architecture as business support architecture, the development process has been very mature. However, when the structure is developed, there are still some problems. To analyze these problems, we have to start with the composition of the SSH architecture.

SSH is the composition of Struts+Spring+Hibernate, Struts implements MVC,Spring is responsible for the combination of architecture, and Hibernate is responsible for data persistence. Usually, the structure diagram of its hierarchical development (take a business addition as an example) is as follows:

This structure meets the general business needs, but for the increasingly complex development of WEB2.0, there are many problems, which can be summed up as follows:

A) DAO and service layer are prone to unclear responsibilities, because according to MVC logic, the business code should be written in Struts Action, but the provision of transactions is configured in the Service layer. In order to have a logically complete set of data operation business logic, two layers (Serveice and Action) are needed to write. In the case of judgment, in order to ensure a complete transaction operation, the business code needs to be moved to the Service layer to complete. However, it is usually used to call multiple Service in Struts Action and generate multiple transactions, but the business data of the Service transaction called before the operation is not rolled back when Exception occurs.

B) when you need the returned data to be used by AJAX, to manipulate the heavy use of JSON or XML. It can be laborious to develop, and a piece of the same business code may need to be rewritten in order to use AJAX and XML, or judged by flags in the same ACTION, causing poor damage to the hierarchical structure. If the design is not good, a large number of additional configurations will have to be added in order to use JSON and XML, which seriously reduces the efficiency of development.

Therefore, in order to overcome these shortcomings, I relayer the SSH architecture and share the business code. Simplify the development and enhance the combination with AJAX technology and MXL technology. Provides a more efficient development model.

The structure diagram of its development is as follows:

Looking at this architecture diagram, one might ask, where is the writing of the Struts Action class? The answer is the advantage of this architecture, because the business code uniformly implements the IbusinessService interface, so that only a few relatively fixed Struts Action classes call the methods of the Service layer to complete the work. Including JSON format output, XML output and WebService output all call Service layer methods to complete the function. This enables the separation of business code and great decoupling from the front-end framework.

The above is what the re-layering based on SSH development architecture is like. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report