listen to the three main framework, about the three framework, do the following understanding :
Three main frames:struts+hibernate+spring
Java The three frameworks are mainly used to make WEN application.
Struts mainly responsible for the display of the presentation layer
Spring take advantage of its IOC and the AOP to handle the control business (responsible for the operation of the database)
Hibernate mostly data persistence to the database
re-use jsp < span> servlet when it comes to web development, there's a web.xml The mapping file, which has a mapping url when you know, The file will correspond to the name you write to a java file, according to the java
a . Struts framework:struts is open source software. Struts is used to help us reduce the time it takes to develop WEB applications using the MVC design model . struts is a good choice if we want to mix the benefits of Servlets and JSPs to build scalable applications .
1. Process: After the server starts, read The Struts-config.xml file contents to memory according to Web. XML load actionservlet .
2 struts to model View all provide the corresponding components. actionservlet struts the core controller, Responsible for intercepting requests from users.
Model part: composed of JavaBean,actionform used to encapsulate the user's request parameters, encapsulated into actionform object, the object is Actionservlet forwards the action, andthe action processes the user's request based on the request parameters inside the Actionfrom. the JavaBean encapsulates the underlying business logic, including database access.
View section: This part is implemented by JSP . Struts provides a rich library of tags that can reduce the use of scripts through a tag library, and a custom tag library enables effective interaction with the Model and adds real-world functionality. The corresponding JSP part.
Controller Components:controller components are composed of two parts-the system core controller, the business logic controller. System core Controller, corresponding to the Actionservlet. The controller is provided by the Struts Framework and inherits the HttpServlet class, so it can be configured as a callout Servlet. The controller is responsible for intercepting all HTTP requests and then deciding whether to transfer to the business logic controller based on user requests. The business logic controller, which is responsible for processing user requests, does not have the processing power, but calls Model to complete processing. Corresponds to the Action section.
two. Spring Framework
Spring is a powerful framework that solves many of the problems that are common in the development of Java EE . Springle provides a consistent approach to managing business objects and encourages the injection of programming to interfaces rather than the good habit of becoming a class. the schema base of Spring is based on the inversion of Control container that uses the JavaBean property . However , Spring is unique in using the IoC container as a complete solution for building play that focuses on all architectural layers. Spring provides a unique data management abstraction that includes a simple and efficient JDBC framework that greatly improves efficiency and reduces possible errors. Spring 's data Access architecture also integrates Hibernate and other O/ R mapping solutions.
three. Hibernate Framework
hibernate is an object-relational mapping framework for open source code for Jdbc > programmers can use objects as they like to manipulate databases. hebernate jdbc< span> java The client program used, also can be in the servlet/jsp web Use the most revolutionary thing in the app, hibernate can be applied ejb J2ee architecture replaces Cmp,
hibernate 5 :session , sessionfactory , transaction , query and configuration 5 A core interface will be used in any development. Through these interfaces, you can not only access persistent objects, but also enable transaction control. These five core interfaces are described separately below.
1. Sessioninterface: Responsible for executing the persisted object'sCRUDOperation(CRUDthe task is to complete the communication with the database, including a lot of commonSQLstatement. ). But it's important to note thatSessionthe object is non-thread-safe. Meanwhile,Hibernateof theSessiondiffers fromJSPin the applicationHttpSession. Here when usingSessionthis term, in fact, refers to theHibernatein theSession, and later will beHttpSessionobject is called a userSession.
2 sessionfactory Interface: Responsible for initializing hibernate session object. The factory model is used here. Note that the sessionfactory sessionfactory enough, when you need to manipulate multiple databases, you can specify a for each database. sessionfactory
3 configuration Interface: Responsible for configuring and starting the hibernate sessionfactory object. In hibernate During the startup process, configuration sessionfactory object.
4 . Transaction Interface: Responsible for transaction-related operations. It is optional, and developers can also design their own underlying transaction-processing code.
5 . Query and Criteria Interface: Responsible for executing various database queries. It can be expressed in either the HQL language or the SQL statement.
This article is from "Ghost" blog, please make sure to keep this source http://caizi.blog.51cto.com/5234706/1548639
Three main frameworks of Java