diff --git a/WebContent/html/javascript/listing.jsp b/WebContent/html/javascript/listing.jsp index 6b6c437..d709c5b 100644 --- a/WebContent/html/javascript/listing.jsp +++ b/WebContent/html/javascript/listing.jsp @@ -1,4 +1,4 @@ -<%@ page import = "database.*,entities.ListedDevice" %> +<%@ page import = "database.*,entities.Device" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> @@ -8,9 +8,9 @@ <% - ListedDevice[] mydevices = DeviceQueries.getAllDevices(); + Device[] mydevices = DeviceQueries.getAllDevices(); //string representation of array. - String deviceString = ListedDevice.arrayToString(mydevices); + String deviceString = Device.arrayToString(mydevices); //out.println(description); //out.println(hardware); %> diff --git a/WebContent/html/javascript/request.jsp b/WebContent/html/javascript/request.jsp index 4536a6e..68ffb65 100644 --- a/WebContent/html/javascript/request.jsp +++ b/WebContent/html/javascript/request.jsp @@ -1,4 +1,4 @@ -<%@ page import = "database.*,entities.ListedDevice" %> +<%@ page import = "database.*,entities.Device" %> <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> @@ -8,9 +8,9 @@ <% -ListedDevice[] mydevices = DeviceQueries.getAllDevices(); +Device[] mydevices = DeviceQueries.getAllDevices(); //string representation of array. -String deviceString = ListedDevice.arrayToString(mydevices); +String deviceString = Device.arrayToString(mydevices); //out.println(description); //out.println(hardware); %> @@ -68,7 +68,7 @@ function show(deviceArray){ // var type = this.getAttribute('data-type'); var html = ''; for (var i = 0; i < deviceArray.length; i++) { - html += '
' + deviceArray[i].name + '

' + deviceArray[i].description + '



' + html += '
' + deviceArray[i].name + '

' + deviceArray[i].description + '



' } if(html.localeCompare("")==0) @@ -175,9 +175,10 @@ function fuzzyFilter(deviceArray) { } function addToCart(){ var id = this.getAttribute('id'); - id = parseInt(id.replace(/[^0-9\.]/g,''),10); //this gets just the numerical value from the id! + id = id.replace(/[^0-9\.]/g,''); if(!inCart(id)){ //if not in the cart var cart = getCartItems(); //this is an array + id = parseInt(id,10); //this gets just the numerical value from the id! cart.push(devices[id - 1]); //push to bottom of cart localStorage.setItem('cart', JSON.stringify(cart)); $('#added').fadeIn(1000); @@ -196,7 +197,7 @@ function inCart(id){ return 0; else{ //something is in the cart for(var i = 0; i < cart.length; i++){ - if(cart[i] === id) + if(id.localeCompare(cart[i].id) == 0) return 1; } } @@ -205,7 +206,7 @@ function inCart(id){ function getCartItems(){ //initiate array for them var cart = new Array; - //get them from local storage + //get them from local age var cart_str = localStorage.getItem('cart'); //if there is at least one object already we need to convert it from JSON to string if (cart_str !== null && cart_str !== "") { diff --git a/WebContent/html/webpages/requestPage.jsp b/WebContent/html/webpages/requestPage.jsp index ebf9e87..47b3aa9 100644 --- a/WebContent/html/webpages/requestPage.jsp +++ b/WebContent/html/webpages/requestPage.jsp @@ -70,7 +70,7 @@
  • -
  • +