6.5. The Purchase Display Page

Section 9.4 of Core Servlets and JavaServer Pages gives detailed code for creating and using a shopping cart. (Remember that Core Servlets and JavaServer Pages is available in its entirety in PDF at http://www.moreservlets.com.) Here, I use a much more simplified “cart” to illustrate how session tracking fits in with Web applications. When a user presses the Submit Order button from one of the item display pages of the previous subsection, the item number is sent to the ShowPurchases servlet of Listing 6.16 (by means of the registered name of DisplayPurchases). This servlet looks up the item associated with the item number, puts the item into an ItemList (Listing 6.17), and forwards the request to the sucker.jsp ...

Get More Servlets and JavaServer Pages™ 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.