Let me tell you about javaEE.
At present, the Java EE application we are discussing is not the classic Java EE application specification stipulated by Sun Company, but a broader application specification. When the classic Java EE application specification is put forward, EJB is the core and the application server is the running environment, so the development and running costs are usually high. At present, the mainstream JavaEE application has all the characteristics of the classic Java EE application specification, such as object-oriented design, clear hierarchical structure, good expansibility and maintainability.
JavaEE applications can be divided into the following five layers:
(1), domain object layer: this layer consists of a series of basic Java objects, which are domain objects of the system and usually have certain business processing capabilities.
(2) DataAccess object layer: This layer is composed of a series of DAO components, and the operations of data table selection (query), insertion (insertion), update (update) and deletion (deletion) are realized at this layer.
(3) Business logic layer: This layer contains business logic components needed by the system, and all business logic methods needed by the system are defined in these components, which is undoubtedly the part of the system architecture that embodies the core value, and usually calls the methods in the DAO layer.
(4) Control layer: This layer is composed of a series of controllers, which mainly calls the business logic method of the service layer to complete the processing of user requests and present different view resources according to the processing results.
(5) Presentation layer: This layer is mainly composed of a series of JSP resources, which is used to present background data to users.
It is precisely because of the stratification above. The following mainstream technologies have emerged:
JSP、Servlet
JSP(Java Server Pages) is a technical standard for dynamic web pages initiated by SunMicrosystems and established by many companies. It inserts Java Scriptlet and JSP tag into the traditional webpage HTML file (*. htm,*。 Html) to form a JSP file (*. jsp)。
Servlet is a server-side Java application, which is independent of platform and protocol and can generate dynamic web pages. It acts as an intermediate layer between client requests (Web browsers or other HTTP clients) and server responses (databases or applications on HTTP servers).
JSP and Servlet are two basic members of JavaEE specification, which are the key technologies of Java Web development and the basic technologies of Java EE development. The essence of JSP and Servlet is the same, so JSP must be compiled into Servlet to run.
Pillar 2
It should be clear to the technicians who do Java development that Struts introduced MVC pattern into one of the frameworks in the field of web development very early. It has been nearly 10 years since Struts 1 was born. Even now many enterprises are using Struts 1 for development, so we have to admit that Struts has been deeply rooted in people's hearts. It forces developers to layer the project modules according to MVC pattern, which makes the development feel a little cumbersome, which is naturally beneficial to the development and post-maintenance of the project, and its value is far higher than the additional cost of development. However, the shortcomings of struts 1 are increasingly exposed, such as the close coupling with Servlet API, which is not conducive to unit testing, and the Struts2 framework of WebWork2 came into being.
Struts2 is an excellent MVC framework, which is easy to use in both design and practical projects. Compared with traditional Struts 1, Struts2 can use ordinary traditional Java objects as actions, and the execute () method of actions is no longer coupled with ServletAPI, which is more conducive to testing. Sruts2 also has the following advantages: supporting more view technologies; The interceptor mechanism based on AOP provides excellent scalability; More powerful and easy-to-use input verification function; Integrated Ajax support and so on.
hibernation
Hibernate is a persistence layer solution for lightweight JavaEE applications. Hibernate not only manages the mapping of Java classes to database tables, but also provides data query and data acquisition methods, which can greatly shorten the time of using JDBC to process data persistence.
At present, the mainstream database is still relational database, while Java language is an object-oriented programming language. When they are used together, it is quite troublesome, and Hibernate reduces the trouble of this problem. Hibernate completes the mapping relationship between object model and relational model based on SQL, which acts as a bridge between object-oriented programming language and relational database, enabling application developers to develop applications completely in an object-oriented way.
spring
Spring is a framework refined from actual development, which provides a lightweight solution for enterprise application development. The scheme includes: the core mechanism based on dependency injection, declarative transaction management based on AOP, integration with various persistence layer technologies, and excellent WebMVC framework. Spring is committed to the application of JavaEE to all levels of solutions, not just focusing on a certain level of solutions. It can be said that Spring is a "one-stop" choice for enterprise application development, which runs through the presentation layer, business layer and persistence layer. However, Spring does not want to replace the existing frameworks, but seamlessly integrates with them with a high degree of openness.
If any Spring mvc doesn't integrate Spring, it's embarrassing to say hello to people, which also confirms the position of Spring in Java enterprise development. Spring subverts the state that non-EJB is not used in Java enterprise development with its control inversion and aspect-oriented programming, and brings Java from the heavyweight old world to the lightweight new world.