SSI (Struts2, Spring, IBatis) Framework Consolidation Summary

Source: Internet
Author: User
Tags connection pooling hosting

MVC is no stranger to us, it originated in the 1980s a software design pattern for Smalltalk language has now been widely used. In recent years, with the prevalence of Java, MVC's low coupling, high reusability, maintainability, manageability of software engineering and many other advantages make it popular in the Java platform, in the meantime, there are many excellent MVC framework, such as focus on the control layer of struts, webwork, Struts2 , JSF frameworks, focus on the spring framework for business logic, Hibernate, IBatis, Castor, Jorm and other frameworks that focus on persistent layers. As a result of the recent use of SSI framework, this article is mainly for Strtus2, Spring, ibatis three open source MVC framework for a summary.

Struts2 mainly comes from the webwork framework, compared with Struts1, in terms of data transmission, STRUTS2 provides a more powerful OGNL tag function, so that it can be directly with the data in the JSP page by defining variables in the action to pass value to each other, The Formbean in Struts1 is omitted, but in the aspect of jump control, Struts2 simplifies the information of the configuration file, makes the exchange between the page and action more concise and intuitive, and facilitates the management of the developers.

Spring is very powerful, such as its control inversion/dependency injection mechanism, which saves us from writing our own factory pattern, implementing classes for the hosting of control classes, business logic classes, data access classes, and Jndi or JDBC data sources. Spring's support for AOP enables us to save a lot of effort in user rights control and transaction processing;

Ibatis is a lightweight or mapping framework, compared to hibernate, Ibatis provides a semi-automated object-relational mapping implementation, developers need to write specific SQL statements, to provide more free space for system design, to facilitate the optimization of SQL statements.

The following diagram is a combination of the three frameworks we use, which we will briefly describe below.

In the control layer, the STRTUS2 tag function is used to interact directly with the data on the JSP page in the action. STRUTS2 provides support for sping when invoking the business logic layer application. The developer needs to complete the configuration of the struts.xml and write the individual action classes.

In the business logic layer, using the Spring framework's dependency injection to implement the instance hosting of the business logic class and the DAO class, and in the transaction processing, we take advantage of the aspect-oriented transaction processing provided by spring, so that the transaction control of the data is divorced from the data access interface implementation, and in the Object relational mapping, Take advantage of Spring's hosting of database connection pooling and support for the Ibatis framework. The developer needs to complete the configuration of the data source, the configuration of the Application*.xml file corresponding to the different modules, and the definition of the business logic interface and the writing of the business logic implementation.

In the persistence layer, with the implementation of semi-automated object relational mapping provided by Ibatis, developers need to write specific SQL statements to provide more free space for system design. In addition, the developer needs to complete the configuration of the Sqlmapconfig.xml and *sqlmap.xml, as well as the definition of the DAO interface and the implementation of the DAO interface.

In the process of exchanging between the layers, the data transmission class is used to transfer and interact with each other. Where the data transfer class corresponds to the database table one by one.

The SSI framework can reduce the coupling of our code, enhance the robustness and reusability of the code, and speed up the development, but there are some shortcomings, for example, because the configuration files of three kinds of frameworks are more, it also brings us some inconvenience, especially for smaller applications.

SSI (Struts2, Spring, IBatis) Framework Consolidation Summary

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.