Sessions do expire. Therefore, you will need to consult your server's documentation to
determine the length of time a session is valid.
Now you are going to look at the really cool part. Click the Proceed to Checkout button. You
should see a screen similar to Figure 5.4, which tells you “Thank you for purchasing:” and dis-
plays the movies you selected.
F IGURE 5.4
The Thank You screen.
The request performed by this form simply calls the same servlet using the GET method. If you
look at the URL your browser now points to, you will notice there is no movie data encoded in
the URL string.
Look at the doGet() method to see exactly how this is done. The first thing you do is get a ref-
erence to the HttpSession object, which is done exactly as before with the getSession()
method. When you have a reference to the session, you can get the list of movies stored in the
session. You do this by calling the HttpSession.getAttribute() method, passing it the name
bound to the movies object. The following code snippet shows how this is done: