Chapter 5. Attributes and Listeners: Being a Web App

image with no caption

No servlet stands alone. In today’s modern web app, many components work together to accomplish a goal. You have models, controllers, and views. You have parameters and attributes. You have helper classes. But how do you tie the pieces together? How do you let components share information? How do you hide information? How do you make information thread-safe? Your life may depend on the answers, so, be sure you have plenty of tea when you go through this chapter. And not that foofy herbal decaf crap.

OBJECTIVES

The Web Container Model

3.1

For the servlet and ServletContext initialization parameters: write servlet code to access initialization parameters, and create deployment descriptor elements for declaring initialization parameters.

3.2

For the fundamental servlet attribute scopes (request, session, and context): write servlet code to add, retrieve, and remove attributes; given a usage scenario, identify the proper scope for an attribute; and identify multi-threading issues associated with each scope.

3.3

Describe the elements of the Web container request processing model: Filter, Filter chain, Request and response wrappers, and Web resource (servlet or JSP page).

Note

Covered in the Filters chapter.

3.4

Describe the Web Container lifecycle event model for requests, sessions, and web applications; create and configure listener classes for ...

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.