Prentice Hall and Sun Microsystems. Personal use only; do not redistribute.
9.4 An On Line Store Using a Shopping Cart and Session Tracking
213
Listing 9.2 CatalogPage.java (continued)
/** POST and GET requests handled identically. */
public void doPost(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException {
doGet(request, response);
}
}
Listing 9.3 KidsBooksPage.java
package coreservlets;
/** A specialization of the CatalogPage servlet that
* displays a page selling three famous kids book series.
* Orders are sent to the OrderPage servlet.
*/
public class KidsBooksPage extends CatalogPage {
public void init() {
String[] ids = { "lewis001", "alexander001", "rowling001" };
setItems(ids);
setTitle("All Time Best Children's Fantasy Books");
}
}
Listing 9.4 TechBooksPage.java
package coreservlets;
/** A specialization of the CatalogPage servlet that
* displays a page selling two famous computer books.
* Orders are sent to the OrderPage servlet.
*/
public class TechBooksPage extends CatalogPage {
public void init() {
String[] ids = { "hall001", "hall002" };
setItems(ids);
setTitle("All Time Best Computer Books");
}
}
Second edition of this book: www.coreservlets.com; Sequel: www.moreservlets.com.
Servlet and JSP training courses by book's author: courses.coreservlets.com.
footer
Our partners:
PHP: Hypertext Preprocessor Best Web Hosting
Java Web Hosting
Jsp Web Hosting
Cheapest Web Hosting
Visionwebhosting.net Business web hosting division of Web
Design Plus. All rights reserved