View Single Post
Old 11-08-2004, 11:37 AM   #1 (permalink)
feelgood
Free Mars!
 
feelgood's Avatar
 
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">&nbsp;</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();">&nbsp;<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>&nbsp;<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">&nbsp;<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">&nbsp;<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%">&nbsp;<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">&nbsp;<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">&nbsp;<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%">&nbsp;<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%">&nbsp;<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">&nbsp;<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">&nbsp;<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>&nbsp;<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">&nbsp;</td>
              <td width="75%" style="vertical-align: middle">
              &nbsp;</td>
            </tr>
          </table>
        </td>
      </tr>
    </table></td>
  <tr>
    <td width="100%" colspan="2" valign="top">&nbsp;</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">&nbsp;<img src="main/products/img/<%=picture1%>" border="1" width="321" height="250"></img>
              <br>&nbsp;<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>
&nbsp;
<button name="Clear" style="width: 85; height: 25; font-family:Tahoma" onclick="javascript:clearForm();">Clear</button>
&nbsp;
<button name="Print" style="width: 85; height: 25; font-family:Tahoma" onclick="javascript:print();">Print</button>
&nbsp;
<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>
However, when I remove the area regarding vendor information, it loads properly again, any idea why it keeps doing that??
__________________
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
feelgood is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360