Here’s the architecture...

Even though this is a tiny application, we’ll build it using a simple MVC architecture. That way, when it becomes THE hottest site on the web, we’ll be ready to extend the application.

1 - The client makes a request for the form.html page.

2 - The Container retrieves the form.html page.

3 - The Container returns the page to the browser, where the user answers the questions on the form and...

image with no caption

4 - The browser sends the request data to the container.

5 - The Container finds the correct servlet based on the URL, and passes the request to the servlet.

6 - The servlet calls the BeerExpert for help.

7 - The expert class returns an answer, which the servlet adds to the request object.

8 - The servlet forwards the request to the JSP.

9 - The JSP gets the answer from the request object.

10 - The JSP generates a page for the Container.

11 - The container returns the page to the happy user.

image with no caption

Note

From here on out when you don’t see the web server, assume it’s there.

Get Head First Servlets and JSP, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.