Talk about three Java frameworks and applications

  • 2020-04-01 03:51:28
  • OfStack

Introduction: for a programmer, especially in the Java web side of the development of programmers, three frameworks: Struts+Hibernate+Spring is must master thoroughly, therefore, the following three Java framework to talk about the basic concepts and principles.

Three JAVA frameworks

Spring Spring is a powerful framework that addresses many of the common problems in J2EE development.

Spring provides a consistent way to manage business objects and encourages good habits of injecting programming to interfaces rather than classes. The architectural basis for Spring is an Inversion of Control container that USES javabeans properties. However, this is only part of the overall picture: Spring is unique in using the IoC container as a complete solution for building all of the architectural layers.
Spring provides a unique data access abstraction, including a simple and efficient JDBC framework, which greatly improves efficiency and reduces possible errors. Spring's data access architecture also integrates Hibernate and other O/R mapping solutions. Spring also provides a unique transaction management abstraction that provides a consistent programming model for various underlying transaction management techniques, such as JTA or JDBC transactions. Spring provides an AOP framework written in the standard Java language that gives POJOs declarative transaction management and other enterprise transactions - if you want - and your own aspects. The framework is powerful enough to allow applications to bypass the complexities of ejbs and enjoy key services related to traditional ejbs. Spring also provides a powerful and flexible MVC Web framework that can be integrated with the IoC container.

Ii. STRUCTS Struts is an MVC framework based on Sun J2EE platform, which is mainly implemented by Servlet and JSP technologies.

Struts has gained a lot of attention in the past year due to its simplicity, ease of use, agility and speed of application development. Struts integrates servlets, JSPS, custom tags and message resources into a unified framework. Developers do not have to code to implement a full set of MVC pattern when they use it for development, which greatly saves time. Therefore, Struts is a very good application framework.

Hibernate is an open source object-relational mapping framework that encapsulates JDBC in a very lightweight way, enabling Java programmers to manipulate databases using object-programming thinking at will.

Hibernate can be used in any situation where JDBC is used. It can be used in both Java client programs and Web applications of servlets/JSPS. Most revolutionary of all, Hibernate can replace CMP in J2EE architecture that applies ejbs and complete the task of data persistence. , Hibernate can replace CMP in J2EE architecture with EJB to complete the task of data persistence.

The three JAVA frameworks are used for WEB applications.

Struts is primarily responsible for displaying the presentation layer. Spring USES its IOC and AOP to handle the control business (responsible for operations on the database)
Hibernate is mainly about the persistence of data to the database. There is a mapping file of web.xml when web page development is done with JSP servlets. There is a label of mapping in it which is used for file mapping. When you enter the URL address in the browser, the file will be according to you write the name of the corresponding to a Java file, according to the content written in the Java file is displayed in the browser, is a web page, so the page name is literally written, whatever the name, no matter you are. PHP, JSP, or do other what are corresponding to the Java file, the code in the Java file for what he wants to do operation, according to a word or connect to the database or jump to other pages, and so on, This Java file encapsulates data for security and ease of administration. In fact, this Java file is compiled as a bytecode file of. Class, rather than a web page file like HTML embedded tags and code. The difference between this and JSP files is that JSPS embed code in HTML tags. There is also a servlet or an HTML form action in struts where the name of the submission corresponds to a Java file.

Summary: in short:

Struts is a web development framework responsible for form submission (equivalent to computer graphics card)
Hibernate takes care of the operation of the database (equivalent to the CPU of the computer)
Spring is the equivalent of a motherboard (putting the graphics card and CPU together)


Related articles: