The Product and Category Classes

Before you can actually display the product and category pages, you need to create the underlying beans that the JSP pages depend on, much as you did with the Customer class in Chapter 8. These beans are a bit different, however, because they don't handle form input. Instead, they get their content by reading from the database (similar to the findCustomer method).

You can start with the product bean because the category bean will need to use it. You can find it in Listing 9.6.

Listing 9.6. Product.java
 package com.bfg.product; import java.util.Vector; import java.util.HashMap; import java.util.Iterator; import java.text.SimpleDateFormat; import java.text.NumberFormat; import org.apache.turbine.services.db.TurbineDB; ...

Get MySQL™ and JSP™ Web Applications: Data-Driven Programming Using Tomcat and MySQL now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.