6.4. The Item Display Servlet
Since prices, descriptions, and pictures of sale items can change, you don’t want to create item description pages by hand. Instead, pages of this sort should be automatically generated. In real life, the data source would probably be a database that is accessed with JDBC (see Chapter 18 of Core Servlets and JavaServer Pages, available in PDF at http://www.moreservlets.com). In this case, a simple data file is used so that the example is short and so that you can run the it without a database.
The item display servlet uses the MVC architecture (see Section 3.8) to display information. First, the servlet (Listing 6.10) reads the itemNum request parameter. If the item number is found, the servlet uses the number as ...
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.