Chapter 2 J2EE Technology New Theory
The overall view of the first J2EE technology
The research method of modern software is gradually popular, first, it will be seen from the so-called architecture. This kind of view is quite reasonable: from the whole, you can see it clearly, and you will be great, not only look far, but you can see it clear. It is clear that it means a thing, such as J2EE, there are things in the end, with the architectural map, can be a bit. The so-called look, can be seen from the architecture, can be compared from the system naturally with other technical systems, and see where the advantages of this system are reflected, the shortcomings are manned, where is the direction of future development? The so-called understanding is clear, it means that the interlaced crowns between the various elements in the architecture, and the art and milder can be able to take a look at it. So whether it is a beginner, or a senior architect, they have a common feature that they like to see the architecture. J2EE is first a organic whole, she is based on J2SE, including 13 major technologies, please see their structure:
(figure 1)
The overall structure of the J2EE platform can be seen, and most of his core technologies are also indicated: JDBC, EJB, RMI, JSP, Java Servlets, XML, JMS, JTS, JTA, Javamail and Jaf. In fact, J2EE is essentially composed of a set of services, applications interface (APIs), and protocols, providing functional support for developing Web-based multi-layer applications. J2EE also requires to describe when these technologies need to be used. Of course, how to interact between different technologies is to understand J2EE.
In the past, the two-layer application - commonly referred to as Client / Server applications - is the most talkative. In many cases, the only service provided by the server is the database service. In this solution, the client program is responsible for data access, implementing business logic, displaying results with appropriate style, popping up the preset user interface, accept user input, etc. The Client / Server structure is usually relatively easy to deploy, but it is difficult to upgrade or improve, and often based on some proprietary protocol - usually a database protocol. It makes it difficult to reuse business logic and interface logic. More importantly, in the web era, the second-floor apps usually cannot reflect good scalability, so it is difficult to adapt to the requirements of the Internet.
The part of the SUN design J2EE is to solve the defects of the secondary structure. Thus, J2EE defines a set of standards to simplify the development of N-layer enterprise applications. It defines a standardized component and provides a complete service for these components. J2EE also automatically handles many implementation details, such as security, multithreading, etc. for applications.
Developing N-layer applications with J2EE includes cutting different levels in the secondary structure into many layers. A N-layer application can provide a separate layer for each of the following services:
Display: In a typical web application, the browser running on the client machine is responsible for implementing the user interface. Of course, the terminal type can be varied.
Representation: Although the browser can complete some dynamic content display, these dynamic generated work should be placed in the web server side, using JSP, SERVLETS, or XML (can be extended) Extended style sheet language).
Business Layer: Business Logic Suitable for implementation with Session EJBS (later will be described later).
Data Access: Data Access is implemented with Entity EJBS (later later) and JDBC. Integration of the same system may need many different techniques, as the best needs to be based on the characteristics of the background system.
Why is there so many layers? In fact, multi-level approach enables enterprise-class applications with strong scalability, which allows each layer to focus on specific roles. For example, let the web server provide pages, apply the server to process the application logic, and the database server provides database services. Since J2EE is based on the Java2 Platform Standard (J2SE), all of the advantages and functions of J2SE are available. Including "Write once, you can use" portability, access to the database through the JDBC, CORBA technology interacting with the original enterprise resources, and a validated security model. On this basis, J2EE adds support for EJB (Enterprise Java Components), Java Servlets, Java Server Page (JSPS), and XML technology.
With the introduction above, if it is not entangled in the implementation of the detail technology (so that there is a architect's discourse), the brain should have the following J2EE architectural map: All implementation J2EE specification Application Server must complete the full Web Container and EJB Container feature. There is a more detailed introduction below for the selection and comparison of Application Server.
(Figure 2)
The second section of J2EE technology
After learning Java, I learned J2EE. The average person will have such a feeling: Getting started is easy, but it is difficult to further seem to be on the shelves, it is difficult. Where is the reason? In essence, there is no understanding J2EE. I don't know what he is reflected in him, just knowing that his part is necessary, but it is not enough. We need to use a new look to examine this peaceful technology, you can say that in essence J2EE is a framework structure, the frame is the meaning of the skeleton. Different from the Java language we have learned, we use the API when learning Java language, which is a toolbox. And J2EE, its application is defined in the beginning, the so-called Java Two Enterprise Edition, means that Java is used in corporate fields. Since the field is set, it can naturally define a set of architectures that are constant in this area. If it defines the JTA, JDBC and EJBs can be used to handle business requirements, a large number of database operational requirements. Enterprises generally use mail subscriptions, message processing, you can use J2EE technology to organically combine JMS, enterprise security requirements, J2EE provides system security solutions, which defines JaaS. In fact, various techniques are a whole and scalable, each J2EE application is assembled in accordance with their architecture. J2EE technology assembly. For example, a layer technology can be used as a JSP accessory. A non-typical WAP can be used. No matter how they are J2EE face; the business layer technology can be EJB, non-typical can be servlets or even JSP, these talents It is the core technology of business processing logic, often requires high security; the resource layer connection is typically JDBC, non-typical use of JDBC-ODBC. As can be seen from the above, J2EE is designed with a frame structure-oriented technology - but this frame structure has extremely strong scalability and scalability. The frame structure means an implementation of ideas, and a large aspect J2EE is widely used in enterprise calculations, and it is believed that the portal that appears after 1998 has adopted J2EE technology. The mode provides support for the constituable content in the framework. It is also an implementation of J2EE or MVC mode. In the above picture, the client gets the view, the intermediate layer is Controller, and the background is Model. Therefore, in the case of enterprise applications, J2EE can take a different solution for situational applications (using a variety of kits). The unchanging thing has been defined, and the change is handed over to the programmer. Some people may think of .NET, in fact, she is also a frame structure, can be said to be a "super (plagiarism) mode application frame structure: - :). Let's take the characteristics of the J2EE architecture with the vision of the pattern (note is not every framework, J2EE flexibility is the largest):
First, flexibility. Flexibility means that this structure or mode is not dependent on any actual application, and should be independent of the operating system and application. Provide an independent structure that provides maximum reuse.
Second, scalability. The development of new technologies is very fast. Imagine an application based on existing J2EE technology, if JDO is introduced into a specification, is this application based on "J2EE"? That is, J2EE's extension will not affect the problem of existing applications. Scalability application architecture does not affect existing applications. The hierarchical achievement of J2EE provides a smoothing transition of various technologies.
Again, scalable. For cluster applications, this functional requirement system has no bans. So far, in addition to the operating system-level cluster, it is probably that only J2EE can do this well in the application level.
Then, configurability. The application itself changes, because the demand will grow with the incompatibility of the personnel. This requires certain flexibility when configuring the application. For example, the access control of resources, only a few Web resources, can be provided to most people; with the expansion of the business, the new business is increasing, the business logic has increased naturally, and the control of this resource requires a flexible Mechanism to make a deployment. This flexible control can be provided in the XML file in J2EE. Finally, safety. Because the improvement in the network environment, the network application is explosive. A basic problem on the network is safe. A secure application should provide unified user access control to provide a single entry point. J2EE is born for the network environment. The front-end controller can achieve safety control in the J2EE mode.