Summary of SSI (Struts2, Spring, iBatis) framework integration, struts2ibatis

Source: Internet
Author: User

Summary of SSI (Struts2, Spring, iBatis) framework integration, struts2ibatis

MVC is no stranger to us. It originated from a software design pattern for the smalltalk language in 1980s and is now widely used. In recent years, with the prevalence of java, MVC's low coupling, high reusability, maintainability, software engineering manageability and many other advantages have made it very popular on the java platform, many excellent MVC frameworks, such as Struts, WebWork, Struts2, and JSF on the control layer, were created, spring framework focusing on business logic, Hibernate, iBatis, Castor, JORM and other frameworks focusing on persistence layer. Because an SSI framework has been used recently, this article mainly summarizes three open-source MVC frameworks: Strtus2, Spring, and iBatis.

 

Struts2 mainly comes from the webwork framework. Compared with Struts1, Struts2 provides more powerful OGNL tag functions in terms of data transmission, this allows the user to define variables in the action to directly pass values with the data on the jsp page, saving formbean in Struts1. In terms of Jump Control, struts2 simplifies the amount of information in the configuration file, makes the exchange between pages and actions more concise and intuitive, and facilitates the management of developers.

 

Spring features are very powerful, such as its control inversion/dependency injection mechanism, saving us from writing factory models by ourselves, the implementation class will host the control class, business logic class, data volume class, And the JNDI or JDBC data source we will use; spring's support for AOP saves us a lot of effort in terms of user permission control and transaction processing;

 

IBatis is a lightweight OR Mapping Framework. Compared with Hibernate, iBatis provides the implementation of semi-automated object relationship ing. developers need to write specific SQL statements, it provides more free space for System Design and convenience for SQL statement optimization.

 

The following figure shows a combination of the three frameworks we use. We will give a brief introduction to these three frameworks.

 

 

In the control layer, use the Strtus2 tag function to directly interact with the data on the jsp page in the Action. When calling a business logic layer application, Struts2 provides support for Sping. Developers need to complete struts. xml configuration and write each Action class.

 

At the business logic layer, the Spring framework's dependency injection is used to host instances of the business logic class and DAO class. In terms of transaction processing, Spring provides a cross-section transaction processing function, the transaction control of data is separated from the data access interface implementation. In terms of object relationship ing, Spring is used to host the database connection pool and support the iBatis framework. Developers need to complete the configuration of the data source, the application *. xml file corresponding to different modules, and the definition of the business logic interface and the compilation of the business logic implementation.

 

In the persistence layer, developers need to write specific SQL statements using the implementation of semi-automated object relationship ing provided by iBatis to provide greater free space for system design. In addition, developers need to complete the configuration of SqlMapConfig. xml and * SqlMap. xml, as well as the definition of DAO interface and the implementation of DAO interface.

 

In the process of exchange between layers, data transmission is used for data transmission and interaction. The data transmission class corresponds to the database table one by one.

 

The SSI framework can reduce the Coupling Degree of our code, enhance the robustness and reusability of the code, and accelerate the development speed, but there are also some shortcomings, for example, because there are many configuration files in the three frameworks, it also brings us some inconvenience, especially for small applications.

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.