-->

Tuesday, April 30, 2019

MVC and the Web

Here are some brief notes on MVC and the Web taken from "Design Patterns" by O'Reilly publishing.


1) You make an HTTP request, which is received by a servlet

Using your web browser, you make an HTTP request (usually with some data, like a user name and password). A servlet receives this form of data and parses it.


2) The Servlet acts as the controller


The servlet plays the role of the controller and processes your requests, most likely making requests on the model (usually a database). The result of processing the request is usually bundled up in the form of a JavaBean.

3) The controller forwards control to the view

The View is represented by a JSP. The JSP's only job is to generate the page representing the view of the model (via a Javabean) along with any controls needed for further actions.

4) The view returns a page to the browser via HTTP

A page is returned to the browser, where it is displayed as the view. The user submits further requests, which are processed in the same fashion.


A Java Server Page:

Enables development of a dynamic user interface
Is an extension of a Servlet
Is a combination of:
Snippets of Java code
Hyper Text Markup Language (HTML)
JavaScript

Cascading Style Sheets (CSS)



--What is a Design Pattern? If not a solution to a problem in a context? (O'Reilly pg. 579)

No comments:

Post a Comment