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 each scope life cycle; create and configure scope attribute listener classes; and given a scenario, identify the proper attribute listener to use.

3.5

Describe the RequestDispatcher mechanism; write servlet code to create a request dispatcher; write servlet code to forward or include the target resource; and identify the additional request-scoped attributes provided by the container to the target resource.

Coverage Notes:

All of the objectives in this section are covered completely in this chapter, with the exception of 3.3, which is covered in the Filters chapter.

Most of what’s in this chapter will come up in other parts of the book, but if you’re taking the exam, THIS is the chapter where we expect you to learn and memorize the objective topics.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset