<%@ include file="header.jsp" %> <% Category category; int columnSize = 3; if (request.getParameter("id") != null) { category = ProductManager.getCategory(request.getParameter("id")); if (category.getID() == null) { throw new Exception("Invalid product ID."); } } else { throw new Exception("The category ID expected by this request was not found."); } %> MotoFrugals - <%= category.getName() %>
<%= category.getHeader() %> Back
<%= category.getDescription() %>
<% if (category.getSubCategories() != null) { %>
Sub-Categories
<% ArrayList list = category.getSubCategories(); int column = 3; Category sub; for (int x = 0; x < list.size(); x++) { sub = (Category)list.get(x); if (sub.isActive() && (sub.getSubCategories() != null || sub.getProducts() != null)) { if (column == columnSize) { out.println(""); column = 0; } column++; %> <% if (column != columnSize) { %> <% } if (column == columnSize) { out.println(""); if ((x + 1) < list.size()) { out.println(""); } } } } while (column != 3) { column++; %> <% if (column != columnSize) { %> <% } if (column == columnSize) { out.println(""); } } %>
<% if (sub.getImage() != null) { %> <% } else { %> <% } %>
<%= sub.getName() %>


<% } else { %>
Number of products in this category: <%= ((category.getProducts() != null)?String.valueOf(category.getProducts().size()):"0") %>
<% if (category.getProducts() != null) { Product prod; Product prod2; ArrayList list = category.getProducts(); for (int x = 0; x < list.size(); x++) { prod = (Product)list.get(x++); if (x < list.size()) { prod2 = (Product)list.get(x); } else { prod2 = null; } if (x != 1) { out.println(""); } %> <% } } %>

<%= prod.getName() %>
<%= prod.getShortDescription() %>
Our Price: $<%= prod.getPrice() %>
<% if (prod2 != null) { %> <% } else { %> <% } %>
<%= prod2.getName() %>
<%= prod2.getShortDescription() %>
Our Price: $<%= prod2.getPrice() %>
 
 
 
<% } %>
<%@ include file="footer.html" %>