11-08-2004, 11:37 AM | #1 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
[JSP] Loading cuts off
Everytime I load this page (See code below) it gets cut off right in the middle
Code:
<%@ page import="java.util.*, accPackage.*" %> <%! private ClassificationsBean classificationsBean; private ClassificationBean classificationBean; private ProductsBean productsBean; private ProductBean productBean; int flag = 0; %> <jsp:useBean id="classificationsBean" scope="session" class="accPackage.ClassificationsBean" /> <jsp:useBean id="classificationBean" scope="session" class="accPackage.ClassificationBean" /> <jsp:useBean id="suppliersBean" scope="session" class="accPackage.SuppliersBean" /> <jsp:useBean id="supplierBean" scope="session" class="accPackage.SupplierBean" /> <jsp:useBean id="productsBean" scope="session" class="accPackage.ProductsBean" /> <jsp:useBean id="productBean" scope="session" class="accPackage.ProductBean" /> <% Vector classifications = classificationsBean.getClassifications(); Vector suppliers = suppliersBean.getSuppliers(); Vector products = productsBean.getProducts(); if(request.getParameter("flag") != null) flag = Integer.parseInt(request.getParameter("flag")); %> <html> <head> <title>Product Information</title> </head> <script language="javascript"> <!-- function loadProducts() { var frm = document.Product; if(frm.ListProduct.options.length == 0) { frm.Type.value = 3; frm.submit(); } else if(frm.Flag.value == 0) { frm.Type.value = 3; frm.submit(); } } function loadProduct() { var frm = document.Product; if(frm.ListProduct.value == "[New]") { alert("Please select a product to search"); } else { frm.Type.value = 6; frm.submit(); } } function loadProduct_Supplier() { var frm = document.Product; frm.Type.value = 3; frm.submit(); } function searchSel1() { var frm = document.Product; var input = frm.ProductID.value.toLowerCase(); var output = frm.ListProduct.options; for(var i = 0; i < output.length; i++) { if(output[i].value.toLowerCase().indexOf(input) == 0) { output[i].selected = true; break; } if(frm.ProductID.value == '') { output[0].selected = true; break; } } } function searchSel2() { var frm = document.Product; var input = frm.ClassificationName.value.toLowerCase(); var output = frm.ListClassification.options; for(var i = 0; i < output.length; i++) { if(output[i].value.toLowerCase().indexOf(input) == 0) { output[i].selected = true; break; } if(frm.ClassificationName.value == '') { output[0].selected = true; break; } } } function addProduct() { var frm = document.Product; if(frm.ListProduct.value == "[New]") { frm.ProductID.value = ""; frm.ListProduct.options[0].selected = true; frm.DateCreated.value = ""; frm.LastUpdated.value = ""; frm.Description.value = ""; frm.ClassificationName.value = ""; frm.ClassificationID.value = ""; frm.ListClassification.options[0].selected = true; frm.Price.value = ""; frm.Product.selected = true; frm.Active.selected = true; frm.Quantity.value = ""; frm.SafetyStock.value = ""; frm.Picture.value = ""; frm.ProductID.focus(); } } function clearForm() { var frm = document.Product; frm.Type.value = 3; frm.submit(); } function print() { var frm = document.Product; if(frm.ProductID.value == "") { alert("Please select a product to print"); } else { frm.Type.value = 1; frm.submit(); } } function goMain() { document.location = "main.html"; } //--> </script> <body onload="javascript:loadProducts();"> <link rel="stylesheet" type="text/css" href="style/style.css" /> <p><font face="Tahoma" size="4">Product Information</font></p> <form method="GET" name="Product" action="/acc/servlet/AccessProduct"> <table border="0" width="100%"> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Product ID:</td> <% String productID = ""; if(productBean.getProductID() != null && flag == 1) productID = productBean.getProductID(); %> <td width="75%"><font face="Tahoma"> </font><!--webbot bot="Validation" s-data-type="String" b-allow-letters="TRUE" b-allow-digits="TRUE" b-allow-whitespace="TRUE" b-value-required="TRUE" i-maximum-length="50" --><input type="text" name="ProductID" size="50" style="font-family:Tahoma" value="<%=productID%>" maxlength="50" onkeyup="javascript:searchSel1();"> <select name="ListProduct" style="font-family:Tahoma" onchange="javascript:addProduct();"> <option value="[New]">[New]</option> <% if(products != null) { for(int i = 0; i < products.size(); i++) { String selected = ""; if(flag == 1) { if(productID.equalsIgnoreCase(((ProductBean)products.get(i)).getProductID())) { selected = "selected"; } } out.println("<option value=\"" + ((ProductBean)products.get(i)).getProductID() + "\" " + selected + ">" + ((ProductBean)products.get(i)).getProductID() + "</option>"); } } %> </select> <button name="Search" style="width: 85; height: 25; font-family:Tahoma" onclick="javascript:loadProduct();">Search</button></td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Date Created:</font></td> <% String dateCreated = ""; if(productBean.getProductID() != null) dateCreated = productBean.getDateCreated().toString(); %> <td width="75%" valign="top"><font face="Tahoma"> <input type="text" name="DateCreated" style="font-family:Tahoma" value="<%=dateCreated%>" size="50" class="ReadOnlyText" readonly="true"> </font></td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Last Updated:</font></td> <% String lastUpdated = ""; if(productBean.getProductID() != null) lastUpdated = productBean.getLastUpdated().toString(); %> <td width="75%" valign="top"><font face="Tahoma"> <input type="text" name="LastUpdated" style="font-family:Tahoma" value="<%=lastUpdated%>" size="50" class="ReadOnlyText" readonly="true"> </font></td> </tr> <tr> <td width="100%" colspan="2" valign="top"><font face="Tahoma">ACC Product Details</font> <table border="1" bordercolor="#111111" cellspacing="0" width="100%"> <tr> <td> <table border="0" width="100%"> <tr> <td width="25%" valign="top" align="right"><font face="Tahoma">Description:</font></td> <% String description = ""; if(productBean.getProductID() != null) description = productBean.getDescription(); %> <td width="75%"> <textarea rows="5" name="Description" cols="50" style="font-family:Tahoma" maxlength="255"><%=description%></textarea></td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Classification:</font></td> <td width="75%" valign="top"> <select size="1" name="ListClassification"> <% if(classifications != null) { for(int i = 0; i < classifications.size(); i++) { String selected = ""; if(flag == 1) { if(productBean.getClassificationID() == ((ClassificationBean)classifications.get(i)).getClassificationID()) selected = "selected"; } out.println("<option value=\"" + ((ClassificationBean)classifications.get(i)).getName() + "\" " + selected + ">" + ((ClassificationBean)classifications.get(i)).getName() + "</option>"); } } %> </select></td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Price:</font></td> <% String price = ""; if(productBean.getProductID() != null) price = String.valueOf(productBean.getPrice()); %> <td width="75%" valign="top"> <input type="text" name="Price" size="50" style="font-family:Tahoma" value="<%=price%>"></td> </tr> <tr> <td width="25%" valign="top" align="right"><font face="Tahoma">Type:</font></td> <td width="75%" valign="top"> <% String productCheck = ""; String partCheck = ""; if(productBean.getProductID() != null && productBean.getType().equals("part")) partCheck = "checked"; else if(productBean.getProductID() != null && productBean.getType().equals("product")) productCheck = "checked"; %> <table border="0" width="100%"> <tr> <td width="0%"> <input type="radio" value="ProductType" <%=productCheck%> name="PType"></td> <td width="100%"><font face="Tahoma">Product</font></td> </tr> <tr> <td width="0%"> <input type="radio" value="PartType" <%=partCheck%> name="PType"></td> <td width="100%"><font face="Tahoma">Part</font></td> </tr> </table> </td> </tr> <tr> <td width="25%" valign="top" align="right"><font face="Tahoma">Status:</font></td> <td width="75%" valign="top"> <% String trueStatus = ""; String falseStatus = ""; if(productBean.getProductID() != null && productBean.getStatus()) trueStatus = "checked"; else if(productBean.getProductID() != null && !productBean.getStatus()) falseStatus = "checked"; %> <table border="0" width="100%"> <tr> <td width="0%"> <input type="radio" value="Active" <%=trueStatus%> name="Status" checked></td> <td width="100%"><font face="Tahoma">Active</font></td> </tr> <tr> <td width="0%"><input type="radio" value="Inactive" <%=falseStatus%> name="Status"></td> <td width="100%"><font face="Tahoma">Inactive</font></td> </tr> </table> </td> </tr> </table> </td> </tr> </table></td> </td> <tr> <td width="100%" colspan="2" valign="top"><font face="Tahoma">Quantity Control Detail <table border="1" bordercolor="#111111" cellspacing="0" width="100%"> <tr> <td> <table border="0" width="100%"> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Quantity:</font></td> <% String quantity = ""; if(productBean.getProductID() != null) quantity = String.valueOf(productBean.getQuantity()); %> <td width="75%"> <input type="text" name="Quantity" size="49" style="font-family:Tahoma" value="<%=quantity%>"></td></td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Safety Stock:</font></td> <% String safetyStock = ""; if(productBean.getProductID() != null) safetyStock = String.valueOf(productBean.getSafetyStock()); %> <td width="75%"> <input type="text" name="SafetyStock" size="49" style="font-family:Tahoma" value="<%=safetyStock%>"></td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: middle"><font face="Tahoma">Unit of Measurement:</font></td> <% String selected0 = ""; String selected1 = ""; String selected2 = ""; String selected3 = ""; String selected4 = ""; if(productBean.getProductID() != null && productBean.getUnit().equals("CM")) selected0 = "selected"; if(productBean.getProductID() != null && productBean.getUnit().equals("EA")) selected1 = "selected"; if(productBean.getProductID() != null && productBean.getUnit().equals("IN")) selected2 = "selected"; if(productBean.getProductID() != null && productBean.getUnit().equals("M")) selected3 = "selected"; if(productBean.getProductID() != null && productBean.getUnit().equals("KM")) selected4 = "selected"; %> <td width="75%" valign="top"> <select name="UnitofMeasurement" style="font-family:Tahoma"> <option <%=selected0%> value="CM">CM</option> <option <%=selected1%> value="EA">EA</option> <option <%=selected2%> value="IN">IN</option> <option <%=selected3%> value="M">M</option> <option <%=selected4%> value="KM">KM</option> </select> </td> </tr> </table> </td> </tr> </table></td> <tr> <td width="100%" colspan="2" valign="top">Vendor Details <table border="1" bordercolor="#111111" cellspacing="0" width="100%"> <tr> <td> <table border="0" width="100%"> <tr> <% String supplierName = ""; if(supplierBean.getCompanyName() != null && flag == 1) supplierName = supplierBean.getCompanyName(); %> <td width="25%" valign="top" align="right" style="vertical-align: top"><font face="Tahoma"> Vendor:</font></td> <td width="75%" style="vertical-align: middle"> <input type="text" name="SupplierName" value="<%=supplierName%>" size="50" style="font-family: Tahoma"> <select name="ListVendor" style="font-family: Tahoma"> <% if(suppliers != null) { for(int i = 0; i < suppliers.size(); i++) { String selected = ""; out.println("<option value=\"" + ((SupplierBean)suppliers.get(i)).getSupplierID() + "\" " + selected + ">" + ((SupplierBean)suppliers.get(i)).getCompanyName() + "</option>"); } } %> </select> <button name="SearchVendor" value="SearchVendor" style="width: 85; height: 25"><font face="Tahoma"> Search</font></button> <% String supplierID = ""; if(supplierBean.getCompanyName() != null && flag == 1) supplierID = String.valueOf(supplierBean.getSupplierID()); %> <br> <input type="text" name="SupplierID" value="<%=supplierID%>" size="50" style="font-family: Tahoma" class="ReadOnlyText" readonly="true"> </td> </tr> <tr> <td width="25%" valign="top" align="right" style="vertical-align: top"> </td> <td width="75%" style="vertical-align: middle"> </td> </tr> </table> </td> </tr> </table></td> <tr> <td width="100%" colspan="2" valign="top"> </td> <tr> <td width="100%" colspan="2" valign="top"><font face="Tahoma">Product Image</font> <table border="1" bordercolor="#111111" cellspacing="0" width="100%"> <tr> <td> <table border="0" width="100%"> <tr> <td width="25%" valign="top"> <% String picture1 = "null.JPG"; String picture2 = ""; if(productBean.getProductID() != null) { picture1 = productBean.getPicture(); picture2 = productBean.getPicture(); } %> <td width="75%" valign="top"> <img src="main/products/img/<%=picture1%>" border="1" width="321" height="250"></img> <br> <input type="text" name="Picture" size="50" style="font-family:Tahoma" value="<%=picture2%>"></td> </tr> </table> </td> </tr> </table></td> </tr> </table> <p align="center"> <button name="Save" style="width: 85; height: 25; font-family:Tahoma">Save</button> <button name="Clear" style="width: 85; height: 25; font-family:Tahoma" onclick="javascript:clearForm();">Clear</button> <button name="Print" style="width: 85; height: 25; font-family:Tahoma" onclick="javascript:print();">Print</button> <button name="Cancel" style="width: 85; height: 25; font-family:Tahoma" onclick="javascript:goMain();">Cancel</button> <input type="hidden" name="Type"> <input type="hidden" name="BackTo" value="Product.jsp"> <input type="hidden" name="Flag" value="<%=flag%>"> </form> </body> </html>
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
11-08-2004, 11:49 AM | #2 (permalink) |
Free Mars!
Location: I dunno, there's white people around me saying "eh" all the time
|
Ok,
After I did some fucking around with the code, I figured that it has to do with Code:
out.println("<option value=\"" + ((SupplierBean)suppliers.get(i)).getSupplierID() + "\" " + selected + ">" + ((SupplierBean)suppliers.get(i)).getCompanyName() + "</option>");
__________________
Looking out the window, that's an act of war. Staring at my shoes, that's an act of war. Committing an act of war? Oh you better believe that's an act of war |
Tags |
cuts, jsp, loading |
|
|