Foreword: For a programmer, especially the programmers developed on the Java Web side, the three major frameworks: Struts+Hibernate+Spring must be familiar. principle.
Java three major frameworks
I. Spring Spring is a powerful framework that solves many problems common in J2EE development.
Spring provides a consistent method for managing business objects and encourages injecting interface programming rather than a good habit of programming. Spring's architecture basis is based on the INVERSION of Control container using the JavaBean property. However, this is only part of the full map: Spring is unique in using the IOC container as a complete solution to build a complete solution that pays attention to all architecture layers.
Spring provides the only data access abstraction, including 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 the only transaction management abstraction, which can provide a consistent programming model at various underlying transaction management technology, such as JTA or JDBC transactions. Spring provides a AOP framework written in standard Java language, which provides POJOS with declarative transaction management and other corporate affairs-if you need-you can also realize your own Aspects. This framework is powerful enough to allow applications to put aside the complexity of EJB while enjoying key services related to traditional EJB. Spring also provides a powerful and flexible MVC Web framework that can integrate with IOC containers.
Second, Structs Struts is a MVC framework based on the Sun J2EE platform, which is mainly implemented using Servlet and JSP technology.
Because Struts can fully meet the needs of application development, simple and easy to use, agile and rapid, it has attracted much attention in the past year. Struts integrates the Servlet, JSP, custom tags and information resources (MESSAGE Resources) into a unified framework. Developers do not need to encode a full set of MVC models by using them for development, so it saves time, so Struts says that Struts It is a very good application framework.
3. Hibernate Hibernate is an object -to -mapping framework for an open source code. It has a very lightweight object packaging on JDBC, so that Java programmers can use the object programming thinking to manipulate the database.
Hibernate can be applied to any occasions using JDBC. It can be used in the Java client program, or it can be used in the web application of Servlet/JSP. The most revolutionary significance is that Hibernate can replace the CMP in the J2EE architecture of the EJB. The task of completing the durability of data. Hibernate can replace CMP in the application of EJB's J2EE architecture to complete the heavy responsibility of data persistence.
The Java three major frameworks are used for web applications.
Struts is mainly responsible for the display Spring using its IOC and AOP to handle the control business (responsible for the operation of the database)
Hibernate is mainly data. When the database is developed with JSP's service, there is a web.xml mapping file. There is a mapping label for file mapping. When you enter the URL address on the browser, the file will correspond to a Java file according to the name you wrote. According to the content written in the Java file, it is displayed on the browser, which is a web page, so the webpage name is written casually. The name that is random, whether you start with .php .jsp.do or other things corresponding to this Java file. The code in this java file is done. Show a sentence or connect to the database or jump to other other jump to other other jump to other other database or jump to other other. Pages, etc., this Java file plays a role in packaging data to be safe and management. In fact, this Java file compiles a bytecode file of the .class. There is not such a web file similar to HTML embedded label and code. The difference between him and JSP file is that JSP embeds the code into the HTML tag. There are also the submission names in the ACTION in the HTML form in Servlet or Struts or a Java file. Struts are generally .do, which were mapped as above.
Summary: Simply put:
Struts is the web development framework responsible for form submission (equivalent to computer graphics card)
Hibernate is responsible for the operation of the database (equivalent to a computer CPU)
Spring is equivalent to a motherboard (assembled the graphics card and CPU)