(No implementation example) Configuration of web application to which MVC model 2 by Java is applied to us who are having a hard time in new employee training

Notes

Overview

MVC model 2

Nowadays, it is often called the MVC model. A type of design pattern that can be used when implementing an application with a UI. MVC is an abbreviation of Model View Controller, and the controller plays the role of holding data and business logic as Model, displaying as View, and connecting them. mvc.png

Web application with MVC model 2 applied

Since Servlet and JSP are used this time, Controller and View correspond to Servlet and JSP, respectively. mvc-j.png

In addition, data is passed between Servlet and JSP via Bean. Bean is a data class and is included in Model. From now on, the class that manipulates data for the purpose of the application will be referred to as BusinessLogic. mvc-j2.png

Since it is a web application, there are users. In addition, the user accesses the application via a web browser. The request from the user is received by the Servlet, and the model is instructed to perform appropriate processing by input. The Servlet confirms that it is ready to return the response to the request and passes control to the JSP. JSP formats the passed data into HTML. mvc-u.png

Here, "appropriate processing" includes validation of input from the user. The Servlet asks FormBean to check the validity, and if the input from the user is appropriate, performs the desired operation (business logic part in the figure). mvc-fb.png

For example, if you want to make an addition app, follow the steps below.

The above is an example that does not use DB, but when using DB, DAO is used. DAO is an abbreviation for Data Access Object, which wraps operations from an application to a DB. The data extracted from the DB by DAO is stored in DTO (Data Transfer Object) and passed. DTO is a data type and follows Java Beans conventions. mvc-db.png

Recommended Posts

(No implementation example) Configuration of web application to which MVC model 2 by Java is applied to us who are having a hard time in new employee training
A quick explanation of each item in new_framework_defaults_6_1.rb, which is a new application setting added in rails 6.1.