Original content: Https://www.tutorialspoint.com/struts_2/basic_mvc_architecture.htm
Apache Struts 2 is an elegant, extensible framework for creating enterprise-class Java Web applications, originally known as WebWork 2.
The purpose of this framework is to simplify the development cycle of the entire Web application, from build to deployment, and subsequent maintenance work.
The following tutorial will teach you in simple steps-how to create an enterprise-level Java Web application using Apache struts.
Audience
This tutorial is designed for Java programmers who want to understand the Struts 2.x framework and its applications , and it will bring you a moderate level of experimentation.
Prerequisite conditions
Before doing this tutorial, you need to have a better understanding of the Java programming language.
A basic understanding of the MVC Framework and JSP or servlet will help you learn.
Basic MVC Architecture
MVC is a design pattern for developing Web applications . This pattern consists of the following three parts:
Model-the lowest level of the pattern, responsible for data maintenance.
View -is responsible for displaying the data to the user.
Controller -responsible for interaction between the model and the view.
MVC is popular because it separates the "user Interface" and "program logic" and supports separation. --controller accepts user requests, prepares the data required for the view with model, and finally generates a visual response from view.
Model
The model is responsible for managing the application's data, which responds to requests for views, instructions from the controller, and updates itself on this basis.
View
Presenting data in a specific format requires a controller trigger;
is a script-based template system, common views are jsp,asp,php , ETC.,
Very easy to integrate with AJAX technology.
Controller
The controller is responsible for responding to user input and interacting with data model objects. It accepts input, validates input, and then performs a business operation that modifies the state of the data model.
Struts2 is an MVC-based framework. in the next section, let's look at-how to use the MVC method in Struts2.
Struts2 notes 01--basic MVC Architecture (GO)