Model 2 architecture was introduced to solve the complexity involved with complex JSPs having multiple responsibilities. This forms the base for the MVC architecture style. The following diagram represents the typical Model 2 architecture:
Model 2 architecture has a clear separation of roles between Model, View, and Controller. This leads to more maintainable applications. A few important details are as follows:
- Model: This represents the data to be used to generate a View.
- View: This uses the Model to render the screen.
- Controller: This controls the flow. It gets the request from the browser, populates the Model, and redirects to the View. Examples in the preceding diagram are Servlet1 and Servlet2.