<%@ page language="java" import="java.util.*, com.pro_gram.data.*, com.pro_gram.utils.Tools, java.io.*, java.text.*" %> Products Catalog

Use the select boxes below (in the designated order) to specify your search criteria
<% String category = Tools.renderSelect(request, out, "Category", "Category", Product.listCategories()); %> > <% String partType = Tools.renderSelect(request, out, "PartType", "Part Type", Product.listPartTypes(category)); %> > <% String manufacturer = Tools.renderSelect(request, out, "Manufacturer", "Manufacturer", Product.listManufacturers(category, partType)); %> >  
> <% String engineType = Tools.renderSelect(request, out, "EngineType", "Engine Type", Product.listEngineTypes(category, partType, manufacturer)); %> > <% String specificEngineType = Tools.renderSelect(request, out, "SpecificEngineType", "Specific Engine Type", Product.listSpecificEngineTypes(category, partType, manufacturer, engineType)); %> > <% String partFamily = Tools.renderSelect(request, out, "PartFamily", "Part Family", Product.listPartFamilies(category, partType, manufacturer, engineType, specificEngineType)); %>  

<% NumberFormat nf = NumberFormat.getCurrencyInstance(Locale.US); long pageSize = 10; long currentPage = Tools.formatValueLong(request.getParameter("currentPage")); long count = Product.countProducts(category, partType, manufacturer, engineType, specificEngineType, partFamily); long pages = count / pageSize + 1; List products = Product.listProducts(category, partType, manufacturer, engineType, specificEngineType, partFamily, (int)((currentPage - 1) * pageSize), (int)pageSize); boolean discountActive = ShoppingCart.isDiscount(); %> <% if (discountActive) { %>

10% discount on orders over $1000.00

<% } %>
Search results: <%= count %> product(s) in <%= pages %> page(s). Page: of <%= pages %> 
<% Iterator i = products.iterator(); while(i.hasNext()) { Product p = (Product)i.next(); %> <% } %>
Item Number Category >  Part Type >  Manufacturer >  Engine Type >  Specific Engine Type >  Part Family
Description
Photo Price Quantity
<%= p.getItemNumber() %> <%= p.getCategory() %> <%= p.getMotorType() %> >  <%= p.getPartType() %> >  <%= p.getManufacturer() %> >  <%= p.getEngineType() %> <%= p.getMaterial() %> >  <%= p.getSpecificEngineType() %> >  <%= p.getPartFamily() %>
<%= p.getDescription() %>
<% if ((p.getPhoto() != null) && (p.getPhoto().length() > 0)) { %> <% } else { out.write(" "); } %> <%= nf.format(p.getPrice()) %>