diff --git a/WebContent/html/javascript/listing.jsp b/WebContent/html/javascript/listing.jsp
index b9b2c73..58a50b1 100644
--- a/WebContent/html/javascript/listing.jsp
+++ b/WebContent/html/javascript/listing.jsp
@@ -1,183 +1,115 @@
-<%@ page import = "database.MySQLAccess,entities.ListedDevice" %>
-<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
-
-
-
-
-Insert title here
-
-
-<%
-MySQLAccess myaccess = new MySQLAccess();
-ListedDevice[] mydevices = myaccess.getAllDevices();
-
-//string representation of array.
-String deviceString = ListedDevice.arrayToString(mydevices);
-//out.println(description);
-//out.println(hardware);
-
-%>
-
-
-
+<%@ page import = "database.MySQLAccess,entities.ListedDevice" %>
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+
+
+
+
+Insert title here
+
+
+<%
+MySQLAccess myaccess = new MySQLAccess();
+ListedDevice[] mydevices = myaccess.getAllDevices();
+
+//string representation of array.
+String deviceString = ListedDevice.arrayToString(mydevices);
+//out.println(description);
+//out.println(hardware);
+
+%>
+
+
+
\ No newline at end of file
diff --git a/src/database/MySQLAccess.java b/src/database/MySQLAccess.java
index 404d095..085193a 100644
--- a/src/database/MySQLAccess.java
+++ b/src/database/MySQLAccess.java
@@ -73,7 +73,7 @@ public ListedDevice[] getAllDevices() throws SQLException, ClassNotFoundExceptio
//iterate result set
while(resultSet.next()){
- devices[counter] = new ListedDevice(resultSet.getString("Device_Name"),resultSet.getString("Device_Description"),resultSet.getString("Hardware"),resultSet.getString("Model"));
+ devices[counter] = new ListedDevice(resultSet.getString("Device_Name"),resultSet.getString("Device_ID"),resultSet.getString("Device_Description"),resultSet.getString("Hardware"), resultSet.getString("Model"),resultSet.getString("Status"));
counter++;
}
diff --git a/src/entities/ListedDevice.java b/src/entities/ListedDevice.java
index 77877dc..b4301ef 100644
--- a/src/entities/ListedDevice.java
+++ b/src/entities/ListedDevice.java
@@ -6,14 +6,18 @@
*/
public class ListedDevice {
private String Device_Name;
+ private String Device_ID;
private String Device_Description;
private String Hardware;
private String Model;
- public ListedDevice(String name, String desc, String hardware, String model) {
+ private String Status;
+ public ListedDevice(String name, String id, String desc, String hardware, String model, String available) {
+ Device_ID = id;
Device_Name = name;
Device_Description = desc;
Hardware = hardware;
Model = model;
+ Status = available;
}
/**
* Formatting the device to fit a JSON object.
@@ -23,8 +27,10 @@ public String toString(){
StringBuilder sb = new StringBuilder();
String comma = ", ";
sb.append("{\"name\": \"").append(Device_Name).append("\"").append(comma);
+ sb.append("\"id\": \"").append(Device_ID).append("\"").append(comma);
sb.append("\"description\": \"").append(Device_Description).append("\"").append(comma);
sb.append("\"hardware\": \"").append(Hardware).append("\"").append(comma);
+ sb.append("\"status\": \"").append(Status).append("\"").append(comma);
sb.append("\"model\": \"").append(Model).append("\"");
sb.append("}");
return sb.toString();