Presentation 1
Presentation 1
model1 architecture
1.) Browser sends request for the JSP page
2.) JSP accesses Java Bean and invokes business logic
3.) Java Bean connects to the database and get/save data 4.) Response is sent to the
browser which is generated by JSP
Navigation control is centralized Now only controller contains the logic to determine the next
page.
Easy to maintain
Easy to extend
Easy to test Better separation of concerns
MVC Pattern stands for Model-View-Controller Pattern. This pattern is used to separate
application's concerns.
Model - Model represents an object or JAVA POJO carrying data. It can also have logic to update
controller if its data changes.
View - View represents the visualization of the data that model contains.
Controller - Controller acts on both Model and view. It controls the data flow into model object
and updates the view whenever data changes. It keeps View and Model separate.
Implementation
We're going to create a Student object acting as a model. StudentView will be a view class which
can print student details on console and StudentController is the controller class responsible to
store data in Student object and update view StudentView accordingly.
MVCPatternDemo, our demo class will use StudentController to demonstrate use of MVC
pattern.