Three Logical Layers in a Web Application:
Model (Business process layer)
@ Encapsulate of data and behavior which are independent of presentation
@ Responsible for actually doing
@ Performing DB queries
@ Calculating the business process
@ Processing orders
@ Models the data and behavior behind the business process
View (Presentation layer)
@ Display information according to client types
@ Display result of business logic (Model)
@ Not concerned with how the information was obtained, or from where (it is the responsibility of Model)
Controller (Control layer)
@ Serves as the logical connection between the user's interaction and the business services on the back
@ Responsible for making decisions among multiple presentations
@ A request enters the application through the control layer, it will decide how the request should be
handled and what information should be returned
JSP pages are used only for presentation
@ Control and application logic handled by a servlet (or set of servlets)
Servlets serves as a gatekeeper
@ Provides common services, such as authentication, authorization, login, error handling, and etc
Servlets serves as a central controller
@ Act as a state machine or an event dispatcher to decide upon the appropriate logic to handle the
request
@ Performs redirecting