SoFunction
Updated on 2025-03-08

A brief discussion on the three major frameworks and applications of Java

Preface: For a programmer, especially those who develop on the java web side, three major frameworks: Struts+Hibernate+Spring must be mastered thoroughly. Therefore, let’s talk about the basic concepts and principles of the three major frameworks of java.

Three major frameworks of JAVA

1. Spring Spring is a powerful framework that solves many common problems in J2EE development.

Spring provides a consistent approach to managing business objects and encourages injection of good habits of programming interfaces rather than class programming. Spring's architecture is based on the Inversion of Control container using JavaBean properties. However, this is only part of the complete picture: Spring is unique in using IoC containers as a complete solution that focuses on all architectural layers.
Spring provides a unique data access abstraction, including a simple and efficient JDBC framework, greatly improving efficiency and reducing possible errors. Spring's data access architecture also integrates Hibernate and other O/R mapping solutions. Spring also provides a unique transaction management abstraction, which can provide a consistent programming model in various underlying transaction management technologies, such as JTA or JDBC transactions. Spring provides an AOP framework written in standard Java language, which provides POJOs with declarative transaction management and other enterprise transactions - if you need - to implement your own aspects. This framework is powerful enough that applications can put aside the complexity of EJB and enjoy key services related to traditional EJBs. Spring also provides a powerful and flexible MVC web framework that can be integrated with IoC containers.

2. STRUCTS Struts is an MVC framework based on the Sun J2EE platform, mainly using Servlet and JSP technology.

Because Struts can fully meet the needs of application development, is simple and easy to use, agile and fast, it has attracted much attention in the past year. Struts integrates Servlets, JSP, custom tags and message resources into a unified framework. Developers do not have to encode and implement a full set of MVC models when developing, which greatly saves time. Therefore, Struts is a very good application framework.

3. Hibernate Hibernate is an open source object-relational mapping framework. It encapsulates JDBC very lightweight object, allowing Java programmers to use object programming thinking to manipulate databases as they wish.

Hibernate can be used in any situation where JDBC is used. It can be used in Java client programs or in Servlet/JSP web applications. The most revolutionary is that Hibernate can replace CMP in the J2EE architecture that applies EJB to complete the important task of data persistence. , Hibernate can replace CMP in the J2EE architecture that applies EJB to complete the important task of data persistence.

JAVA three major frameworks are used for WEB applications.

struts is mainly responsible for the display of the presentation layer. Spring uses its IOC and AOP to handle control services (responsible for the operation of the database)
Hibernate mainly persists data to the database. When using JSP servlet for web development, there is a mapping file, and there is a mapping tag in it for file mapping. When you enter the URL address in the browser, the file will correspond to a java file according to the name you wrote, and it will be displayed on the browser according to the content written in the java file. It is a web page. Therefore, the web page name is written casually, and the name is named casually. No matter whether you are calling .php .jsp .do or anything else, it corresponds to the java file. The code in this java file will do whatever it does, whether it is displayed, it will connect to the database or jump to other pages, etc. This java file encapsulates the data to play a safe and easy-to-manage. In fact, this java file is compiled as a bytecode file of .class, and there is no such web file similar to html embedded tags and code. The difference between it and jsp files is that jsp embeds the code into the html tag. There is also the submission name in the action of the html form in servlet or struts corresponds to a java file. struts are generally .do, and they are mapped like the above.

Summary: Simply put:

Struts is a web development framework responsible for form submission (equivalent to computer graphics card)
Hibernate is responsible for operating the database (equivalent to computer CPU)
Spring is equivalent to a motherboard (assembly the graphics card and the CPU together)