In the last blog, we talked about components at the end of the article, and this blog goes on to discuss what the components of Java EE applications are, and what technology these components are mainly using.
first of all, we need to know what the component here is called.
Baidu Encyclopedia gives the explanation is: the component (Component) is to the data and the method simple encapsulation. Components can have their own properties and methods. property is a simple visitor to the component data. The method is a simple and visible feature of the component. Using components enables drag-and-drop programming, fast property processing, and real object-oriented design.
From the above description, it is actually an object-oriented idea, or it is describing a class, because an object or class is composed of attributes and methods. While our Java EE applications are made up of components, Java EE components are self-contained units that are assembled through related classes and files, become applications, and interact with other components. For example: Controller components, EAO components, presentation layer components, and so on. Below we will say the details of each layer based on the Java EE layered model.
Presentation Layer components:
Mainly responsible for collecting user input data, or showing the system State to the customer. The most commonly used presentation layer technology is JSP, but JSP is not the only performance layer technology. The presentation layer can also be accomplished by velocity, freemaker, and tapestry, or by using a common application as a performance layer component, or even a small smart device such as our phone, ipad, and so on.
Controller components:
For the Java EE MVC Framework, the framework provides a front-end core controller, which is responsible for intercepting user requests and forwarding requests to the user-implemented controller components. These user-implemented controllers are responsible for processing the calling business logic method and processing user requests.
Business logic Components:
These components are the core components of the system and implement the business logic of the system. Typically, a business logic method corresponds to a user operation. A business logic approach should be a whole, so we need to add transactional to the business logic approach. The business logic approach is solely responsible for implementing business logic and should not be accessed by the database. Therefore, the original hibernate should not appear in the business logic component. JDBC and other APIs.
Why should the business logic be separated from the persistence layer technology? One important reason is that when the system needs to switch between different persistence layer technologies, the system's business logic components need not be changed.
DAO Components:
The data Access object, also known as the DataSet. This type of object is less varied, and each DAO component provides basic creation, query, update, and delete operations for the domain object object, which correspond to atomic operations such as CRUD in the datasheet. Of course, the implementation of the DAO component is completely different if you use different persistence layer access techniques. To separate the implementation of the business logic component from the implementation of the DAO component, we provide an interface for each DAO component, and the business logic component is programmed for the DAO interface to provide better decoupling.
domain Object Components :
The domain object (domain objects) abstracts the system's object model. Generally, the state of these domain objects must be kept in the database. Therefore, each domain object typically corresponds to one or more data tables, and the domain objects often need to provide access to the data records.
A brief summary;
Finally, put up a picture to help you better understand the relationship between Java EE Application architecture and various technologies.
In fact, many people will have the question: I can use JSP to complete the system, why there is so much effort to divide the system so. Each layer uses a different technical framework. Is it necessary?
I want to say is that for personal learning, entertaining personal site, you do not matter, but for large information systems, you have to consider carefully, maintenance, scalability, reusability and so on are the problems, a good understanding of it.