Chapter 6. Application and Session Events

Application and Session Events

In Chapter 3, “Writing Servlet Applications,” you learned how to use the ServletContext object to share information among all the servlets in a web application. You also learned how to obtain this object so that you can use its methods. The ServletContext object is created by the servlet container, and, among other things, it has a method called setAttribute. That method causes the object to act like a Hashtable, where you can store an object that is identified by a key and later retrieve the object by passing the key.

In Chapter 5, “Session Management,” you learned how to create and invalidate the HttpSession ...

Get Java for the Web with Servlets, JSP, and EJB: A Developer’s Guide to J2EE Solutions 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.