June 2005
Beginner to intermediate
336 pages
6h 29m
English
A session lets you track one user at a time—an application lets you share data between many users. To access the current application, you can use the built-in JSP application object. Like the session object, the application object is based on the javax.servlet.http.HttpSession interface.
In the previous example, you saw how to create a session attribute named counter that stores the number of times the user has visited the page in the current session. In the same way, you can create an application attribute named counter that holds the total number of times anyone in the same application has viewed a JSP page:
Integer counter = (Integer)application.getAttribute("counter"); if (counter == null) { counter ...Read now
Unlock full access