%@ include file="header.jsp" %> <%@ page import="java.text.*" %> <% NumberFormat format = NumberFormat.getInstance(); format.setMaximumFractionDigits(2); format.setMinimumFractionDigits(2); format.setGroupingUsed(false); Product prod; if (request.getParameter("id") != null) { prod = ProductManager.getProduct(request.getParameter("id")); if (prod == null || prod.getId() < 0) { throw new Exception("Invalid product ID."); } boolean showLogs = true; Cookie cookie; Cookie[] cookies = request.getCookies(); if (cookies != null) { for (int x = 0; x < cookies.length; x++) { cookie = cookies[x]; if (cookie.getName().equals("nologs")) { showLogs = false; } } } if (showLogs) { LogManager.logProduct(request.getParameter("id"), request.getHeader("X-Forwarded-For")); } } else { throw new Exception("The product ID expected by this request was not found."); } %>