From 8448e1c201a0a6710a6b789f41dea46d1ba3187b Mon Sep 17 00:00:00 2001 From: Adam R Claxton Date: Wed, 22 Feb 2017 22:15:09 -0500 Subject: [PATCH] Shop.jsp can now communicate with the dataabase! Yay! Submitting the form does not do everything it needs to do with tables yet. There is a good deal of polishing and refactoring to now too. --- WebContent/html/javascript/shop.jsp | 79 ++- WebContent/html/javascript/shoppingCart.js | 2 +- WebContent/html/webpages/orderFormHandler.jsp | 23 + WebContent/html/webpages/shoppingCart.jsp | 11 +- db/db.sql | 514 ++++++++++++++++++ src/database/MySQLAccess.java | 66 ++- src/entities/Admin.java | 4 +- src/entities/User.java | 20 +- 8 files changed, 701 insertions(+), 18 deletions(-) create mode 100644 WebContent/html/webpages/orderFormHandler.jsp create mode 100644 db/db.sql diff --git a/WebContent/html/javascript/shop.jsp b/WebContent/html/javascript/shop.jsp index 5a543d7..d81ecf9 100644 --- a/WebContent/html/javascript/shop.jsp +++ b/WebContent/html/javascript/shop.jsp @@ -1,19 +1,20 @@ +<%@ page import = "database.MySQLAccess" %> +<%@ page import = "entities.User" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" +pageEncoding="ISO-8859-1"%> + + + + + + + + diff --git a/WebContent/html/javascript/shoppingCart.js b/WebContent/html/javascript/shoppingCart.js index eec90fc..a067c44 100644 --- a/WebContent/html/javascript/shoppingCart.js +++ b/WebContent/html/javascript/shoppingCart.js @@ -86,7 +86,7 @@ function show(){ var id = cart[i]; //this gets the id value from the cart for(var j = 0; j < devices.length; j++){ //iterate device list if(devices[j].id === id){ //match the id's "nhpup.popup(' ');" - html += '

' + devices[j].name + '

'; //create listing of all the devices + html += '
< put class = "deviceCheckbox" type = "checkbox" id = "' + id + '">

' + devices[j].name + '

'; //create listing of all the devices break; //break out of loop when we match } } diff --git a/WebContent/html/webpages/orderFormHandler.jsp b/WebContent/html/webpages/orderFormHandler.jsp new file mode 100644 index 0000000..ba3f08d --- /dev/null +++ b/WebContent/html/webpages/orderFormHandler.jsp @@ -0,0 +1,23 @@ +<%@ page import = "database.MySQLAccess" %> +<%@ page import = "entities.User" %> +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" +pageEncoding="ISO-8859-1"%> + + + + + + +<% +//First update employee +String userName = request.getParameter("name"); +int phone = Integer.valueOf(request.getParameter("phone")); +int location = Integer.valueOf(request.getParameter("location")); +MySQLAccess access = new MySQLAccess(); +access.updateEmployee(1, userName, phone, location); //TODO get ID somehow + +// And now for the ticket +// TODO +%> + + \ No newline at end of file diff --git a/WebContent/html/webpages/shoppingCart.jsp b/WebContent/html/webpages/shoppingCart.jsp index 679f0a4..1235fda 100644 --- a/WebContent/html/webpages/shoppingCart.jsp +++ b/WebContent/html/webpages/shoppingCart.jsp @@ -44,6 +44,7 @@