Java Reference
In-Depth Information
Chapter 9
Advanced Features Made Easy
The webmail application is moving along nicely. Let's finishing imple-
menting the three message pages.
9.1
Managing Session Data
In the list of folders that appears on the left of the Message List and
Message Details pages, the currently selected folder is indicated with
an arrow next to the name of the folder, as we can see in Figure 9.1 .
We need a place to store the currently selected Folder object. As the user
navigates in different pages of the application, it'd be nice to remember
the last selected folder so that we show its contents when the user
returns to the Message List page.
Such per-user state information is usually stored in the session. If
you've worked with the Servlet API's HttpSession interface before, you
know that things can get messy when you litter your code with calls
to setAttribute ( ) and getAttribute ( ). Both these methods require us to use
Figure 9.1: Showing the currently selected folder
 
 
 
 
 
Search WWH ::




Custom Search