What is MVC model?

I wanted to understand the MVC model properly, so I wrote an article.

Since you are a beginner, please point out if there is a misunderstanding.

What is MVC

・ Model
In charge of DB related processing

・ View
In charge of screen display (HTML)

・ Controller
Request reception & response return

The idea of dividing the responsibility of the program into three MVCs in this way is called the MVC model.

Process flow

dd3e967f498ce117d1cdd29953e92cdc.png

First, the user requests some URL. Then, in the framework, a router accepts URL requests. The router is the part that performs the assignment process that assigns the received URL to the action of which controller. The router then calls the action. The controller receives this request and queries the database for item / 1 item information. When querying the database, the controller queries the model.

e8957306a62031f5d4512f4a0129667a.png

The model interacts with the database and returns the results to the controller. In this way, the model is the part that interacts with the database. The controller that then receives the data from the model then transfers the data to the view. The view then uses this information to generate an Html for dynamic return. The generated controller is returned to User as a response.

In this way, the MVC model has three roles: Controller, Model, and View. There is also what is called a router for calling the controller.

Recommended Posts

What is MVC model?
What is the Java Servlet / JSP MVC model?
MVC model
What is Cubby
What is Docker?
What is null? ]
What is Keycloak
What is maven?
What is Jackson?
What is Docker
What is self
What is Jenkins
What is ArgumentMatcher?
What is params
What is SLF4J?
What is Facade? ??
What is Java <>?
What is Gradle?
What is POJO
What is Java
What is centOS
What is RubyGem?
What is programming?
What is before_action?
What is Docker
What is Byte?
What is Tomcat
What is the model test code testing
What is Maven Assembly?
What is `docker-compose up`?
What is a constructor?
What is vue cli
What is an interface?
What is Ruby's self?
Spring MVC: What happens when `@ RequestParam` is omitted
What is hard coding?
What is a stream
What is Ruby's attr_accessor?
The MVC model at my workplace is terrible
What is Java Encapsulation?
What is permission denied?
What is instance control?
What is an initializer?
What is Spring Tools 4
What is an operator?
What is object orientation?
What is Guava's @VisibleForTesting?
What is an annotation?
What is Java technology?
What is Java API-java
What is @ (instance variable)?
What is Gradle's Artifact?
What is JPA Auditing?
[Swift] What is dismiss?
[Java] What is flatMap?
What is a Servlet?
What is web development?
[Java] What is JavaBeans?
[Android] What is Context? ??
[Java] What is ArrayList?
[Ruby] What is true?