Struts 2 MVC Architecture

shape Description

Struts 2 MVC Architecture, Struts2 framework is defined in most of the MVC (Model View Controller) based applications, before that user should have an idea about what MVC is. Model View Controller is the popular design pattern which is utilized to build web applications and it consists of three parts where each one will have its own functionality, where controller is the responsibility for carrying the little code through which request will be sent to the server, when the server takes the request model is the responsibility to check the data availability and view is utilized to expose the data to an user. Following is the conceptual figure which describes functioning of each module.

Model:Model is responsible to carry data and it is the low level of the pattern.
View:View is responsible to expose the carried data to an user.
Controller:Controller will provide interaction between the model and view. Controller will have the code, requests and responses will be handled from here.

MVC1 Architecture

shape Conceptual
figure

In a servlet, the presentation logic and persistence logic are defined, then servlet will act as a controller and view pages. If any changes occurred in a browser, the application will be deployed on the server, which is the drawback of MVC1.

MVC2 Architecture

shape Conceptual
figure

In MVC2, Controller and views are defined separately.

Summary

shape Key Points

  • Struts 2 MVC Architecture – MVC is the design pattern utilized to build web applications.
  • Struts 2 MVC Architecture – The big drawback of Servlet is that if any modification is done.
  • Struts 2 MVC Architecture – The drawback of Servlet will be overcome by JSP.