From 82797bf4c17069a445f3be190e7d8091db3d22f7 Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Thu, 6 Aug 2015 14:17:27 +0200 Subject: [PATCH] =?utf8?q?Moved=20some=20classes=20+=20other=20stuff=20Sig?= =?utf8?q?ned-off-by:Roland=20H=C3=A4der=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../application/PizzaApplication.java | 4 +- .../application/PizzaServiceApplication.java | 6 +- .../pizzaapplication/customer/Customer.java | 27 +++++ .../customer/PizzaServiceCustomer.java | 26 +++++ .../customer/bean/CustomerBean.java | 27 +++++ .../product/PizzaProduct.java | 2 +- .../product/Product.java | 2 +- web/bye.jsp | 3 +- web/errorHandler.jsp | 9 +- web/finished.jsp | 36 +++--- web/index.jsp | 21 ++-- web/order.jsp | 107 +++++++++++++++--- web/style.css | 25 ++++ 13 files changed, 245 insertions(+), 50 deletions(-) rename src/java/org/mxchange/{pizzaservice => pizzaapplication}/application/PizzaApplication.java (98%) rename src/java/org/mxchange/{pizzaservice => pizzaapplication}/application/PizzaServiceApplication.java (99%) create mode 100644 src/java/org/mxchange/pizzaapplication/customer/Customer.java create mode 100644 src/java/org/mxchange/pizzaapplication/customer/PizzaServiceCustomer.java create mode 100644 src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java rename src/java/org/mxchange/{pizzaservice => pizzaapplication}/product/PizzaProduct.java (98%) rename src/java/org/mxchange/{pizzaservice => pizzaapplication}/product/Product.java (96%) create mode 100644 web/style.css diff --git a/src/java/org/mxchange/pizzaservice/application/PizzaApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java similarity index 98% rename from src/java/org/mxchange/pizzaservice/application/PizzaApplication.java rename to src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java index d3867988..a01c56d8 100644 --- a/src/java/org/mxchange/pizzaservice/application/PizzaApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java @@ -14,14 +14,14 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaservice.application; +package org.mxchange.pizzaapplication.application; import java.util.Iterator; import java.util.Map; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.mxchange.jcore.application.Application; -import org.mxchange.pizzaservice.product.Product; +import org.mxchange.pizzaapplication.product.Product; /** * diff --git a/src/java/org/mxchange/pizzaservice/application/PizzaServiceApplication.java b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java similarity index 99% rename from src/java/org/mxchange/pizzaservice/application/PizzaServiceApplication.java rename to src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java index 31ce7240..8a6e4bf1 100644 --- a/src/java/org/mxchange/pizzaservice/application/PizzaServiceApplication.java +++ b/src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaservice.application; +package org.mxchange.pizzaapplication.application; import java.text.MessageFormat; import java.util.Iterator; @@ -26,8 +26,8 @@ import javax.servlet.ServletException; import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpSession; import org.mxchange.jcore.BaseFrameworkSystem; -import org.mxchange.pizzaservice.product.PizzaProduct; -import org.mxchange.pizzaservice.product.Product; +import org.mxchange.pizzaapplication.product.PizzaProduct; +import org.mxchange.pizzaapplication.product.Product; /** * diff --git a/src/java/org/mxchange/pizzaapplication/customer/Customer.java b/src/java/org/mxchange/pizzaapplication/customer/Customer.java new file mode 100644 index 00000000..8dd11480 --- /dev/null +++ b/src/java/org/mxchange/pizzaapplication/customer/Customer.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.pizzaapplication.customer; + +import org.mxchange.jcore.contact.Contact; + +/** + * + * @author Roland Haeder + */ +public interface Customer extends Contact { + +} diff --git a/src/java/org/mxchange/pizzaapplication/customer/PizzaServiceCustomer.java b/src/java/org/mxchange/pizzaapplication/customer/PizzaServiceCustomer.java new file mode 100644 index 00000000..a83f0656 --- /dev/null +++ b/src/java/org/mxchange/pizzaapplication/customer/PizzaServiceCustomer.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.pizzaapplication.customer; + +import org.mxchange.jcore.contact.BaseContact; + +/** + * + * @author Roland Haeder + */ +public class PizzaServiceCustomer extends BaseContact implements Customer { +} diff --git a/src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java b/src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java new file mode 100644 index 00000000..459f5bcf --- /dev/null +++ b/src/java/org/mxchange/pizzaapplication/customer/bean/CustomerBean.java @@ -0,0 +1,27 @@ +/* + * Copyright (C) 2015 Roland Haeder + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +package org.mxchange.pizzaapplication.customer.bean; + +import org.mxchange.pizzaapplication.customer.PizzaServiceCustomer; + +/** + * + * @author Roland Haeder + */ +public class CustomerBean extends PizzaServiceCustomer { + +} diff --git a/src/java/org/mxchange/pizzaservice/product/PizzaProduct.java b/src/java/org/mxchange/pizzaapplication/product/PizzaProduct.java similarity index 98% rename from src/java/org/mxchange/pizzaservice/product/PizzaProduct.java rename to src/java/org/mxchange/pizzaapplication/product/PizzaProduct.java index a287754c..ba32ecb5 100644 --- a/src/java/org/mxchange/pizzaservice/product/PizzaProduct.java +++ b/src/java/org/mxchange/pizzaapplication/product/PizzaProduct.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaservice.product; +package org.mxchange.pizzaapplication.product; import java.text.MessageFormat; import org.mxchange.jcore.BaseFrameworkSystem; diff --git a/src/java/org/mxchange/pizzaservice/product/Product.java b/src/java/org/mxchange/pizzaapplication/product/Product.java similarity index 96% rename from src/java/org/mxchange/pizzaservice/product/Product.java rename to src/java/org/mxchange/pizzaapplication/product/Product.java index 71cca43c..dfe5a70a 100644 --- a/src/java/org/mxchange/pizzaservice/product/Product.java +++ b/src/java/org/mxchange/pizzaapplication/product/Product.java @@ -14,7 +14,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -package org.mxchange.pizzaservice.product; +package org.mxchange.pizzaapplication.product; import org.mxchange.jcore.FrameworkInterface; diff --git a/web/bye.jsp b/web/bye.jsp index 81001e86..f58324ef 100644 --- a/web/bye.jsp +++ b/web/bye.jsp @@ -5,12 +5,13 @@ --%> <%@page errorPage="errorHandler.jsp" %> -<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%> + <%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden diff --git a/web/errorHandler.jsp b/web/errorHandler.jsp index f6b957ff..813977e0 100644 --- a/web/errorHandler.jsp +++ b/web/errorHandler.jsp @@ -4,19 +4,20 @@ Author : Roland Haeder --%> -<%@page import="org.mxchange.pizzaservice.application.PizzaApplication"%> -<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%> <%@page import="java.io.PrintWriter"%> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <% - // Init service instance - PizzaApplication service = PizzaService.getInstance(application); + // Init application instance + PizzaApplication app = PizzaServiceApplication.getInstance(application); %> + <%=PizzaServiceApplication.MAIN_TITLE%> - Fehler diff --git a/web/finished.jsp b/web/finished.jsp index 2159a128..68322e02 100644 --- a/web/finished.jsp +++ b/web/finished.jsp @@ -4,22 +4,28 @@ Author : Roland Haeder --%> -<%@page import="org.mxchange.pizzaservice.application.PizzaApplication"%> -<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%> <%@page errorPage="errorHandler.jsp" %> +<%@page contentType="text/html" pageEncoding="UTF-8"%> + <%@page import="java.util.Map"%> <%@page import="java.util.Iterator"%> -<%@page import="org.mxchange.pizzaservice.product.Product"%> -<%@page contentType="text/html" pageEncoding="UTF-8"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%> +<%@page import="org.mxchange.pizzaapplication.customer.Customer" %> +<%@page import="org.mxchange.pizzaapplication.product.Product"%> + + + <% - // Init service instance - PizzaApplication service = PizzaServiceApplication.getInstance(application); + // Init application instance + PizzaApplication app = PizzaServiceApplication.getInstance(application); %> + <%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank! @@ -61,7 +67,7 @@ <% // Get iterator from products - Iterator> iterator = service.getProductsIterator(); + Iterator> iterator = app.getProductsIterator(); // Iterate over all while (iterator.hasNext()) { @@ -72,14 +78,14 @@ Product product = entry.getValue(); // Mark product as ordered - service.markProductAsOrdered(product, session); + app.markProductAsOrdered(product, session); %> - <%=service.getPrintableChoosenFromRequestSession(product, request, session)%> + <%=app.getPrintableChoosenFromRequestSession(product, request, session)%> - <%=service.handleAmountFromRequestSession(product, request, session)%> + <%=app.handleAmountFromRequestSession(product, request, session)%> <%=product.getTitle()%> @@ -88,19 +94,19 @@ <%=product.getPrice()%> - <%=service.getTotalPositionPriceFromRequestSession(product, request, session)%> + <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%> <% } - float totalPrice = service.calculateTotalPrice(request, session); + float totalPrice = app.calculateTotalPrice(request, session); %> Menge: - <%=service.calculateTotalAmount(request, session)%> + <%=app.calculateTotalAmount(request, session)%>   @@ -116,10 +122,10 @@ <% - if (("POST".equals(request.getMethod())) && (service.calculateTotalAmount(request, session) > 0)) { + if (("POST".equals(request.getMethod())) && (app.calculateTotalAmount(request, session) > 0)) { out.print("Ihre Bestellung ist eingegangen."); synchronized(session) { - session.invalidate(); + //session.invalidate(); } } else { // Nothing ordered diff --git a/web/index.jsp b/web/index.jsp index 70bfa5e3..d2c0ea7f 100644 --- a/web/index.jsp +++ b/web/index.jsp @@ -7,19 +7,20 @@ <%@page errorPage="errorHandler.jsp" %> <%@page import="java.util.Map"%> <%@page import="java.util.Iterator"%> -<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%> -<%@page import="org.mxchange.pizzaservice.application.PizzaApplication"%> -<%@page import="org.mxchange.pizzaservice.product.Product"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%> +<%@page import="org.mxchange.pizzaapplication.product.Product"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <% - // Init service instance - PizzaApplication service = PizzaServiceApplication.getInstance(application); + // Init application instance + PizzaApplication app = PizzaServiceApplication.getInstance(application); %> + <%=PizzaServiceApplication.MAIN_TITLE%> - Eingangsseite @@ -56,10 +57,11 @@ + <% // Get iterator from products - Iterator> iterator = service.getProductsIterator(); + Iterator> iterator = app.getProductsIterator(); // Iterate over all while (iterator.hasNext()) { @@ -68,14 +70,14 @@ // Get product Product product = entry.getValue(); - service.unmarkProductAsOrdered(product, session); + app.unmarkProductAsOrdered(product, session); %> - /> + /> - + <%=product.getTitle()%> @@ -87,6 +89,7 @@ <% } %> + diff --git a/web/order.jsp b/web/order.jsp index 05da6f6a..a6a3b851 100644 --- a/web/order.jsp +++ b/web/order.jsp @@ -7,19 +7,20 @@ <%@page errorPage="errorHandler.jsp" %> <%@page import="java.util.Iterator"%> <%@page import="java.util.Map"%> -<%@page import="org.mxchange.pizzaservice.product.Product"%> -<%@page import="org.mxchange.pizzaservice.application.PizzaApplication"%> -<%@page import="org.mxchange.pizzaservice.application.PizzaServiceApplication"%> +<%@page import="org.mxchange.pizzaapplication.product.Product"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%> +<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%> <%@page contentType="text/html" pageEncoding="UTF-8"%> <% - // Init service instance - PizzaApplication service = PizzaServiceApplication.getInstance(application); + // Init application instance + PizzaApplication app = PizzaServiceApplication.getInstance(application); %> + <%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen @@ -62,7 +63,7 @@ <% // Get iterator from products - Iterator> iterator = service.getProductsIterator(); + Iterator> iterator = app.getProductsIterator(); // Iterate over all while (iterator.hasNext()) { @@ -74,10 +75,10 @@ %> - <%=service.getPrintableChoosenFromRequestSession(product, request, session)%> + <%=app.getPrintableChoosenFromRequestSession(product, request, session)%> - <%=service.handleAmountFromRequestSession(product, request, session)%> + <%=app.handleAmountFromRequestSession(product, request, session)%> <%=product.getTitle()%> @@ -86,15 +87,15 @@ <%=product.getPrice()%> - <%=service.getTotalPositionPriceFromRequestSession(product, request, session)%> + <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%> <% // Is it choosen and amount set? - if (service.isProductChoosen(product, request, session)) { + if (app.isProductChoosen(product, request, session)) { // Then mark it as choosen product.markAsChoosen(); - service.unmarkProductAsOrdered(product, session); + app.unmarkProductAsOrdered(product, session); } } %> @@ -103,7 +104,7 @@ Menge: - <%=service.calculateTotalAmount(request, session)%> + <%=app.calculateTotalAmount(request, session)%>   @@ -112,13 +113,91 @@ Gesamtpreis: - <%=service.calculateTotalPrice(request, session)%> + <%=app.calculateTotalPrice(request, session)%> + + + + + +
+ Bitte Ihre Daten eingeben: + +
+
+ +
+
+ /> +
+
+
+ +
+
+ +
+
+ /> +
+
+
+ +
+
+ +
+
+ /> +
+
+
+ +
+
+ +
+
+ /> +
+
+
+ +
+
+ +
+
+ /> +
+
+
+ +
+
+ +
+
+ /> +
+
+
+ +
+
+ +
+
+ /> +
+
+
+
- /> + /> diff --git a/web/style.css b/web/style.css new file mode 100644 index 00000000..18c45f57 --- /dev/null +++ b/web/style.css @@ -0,0 +1,25 @@ + +.data_row { + width: 100%; +} + +.data_left { + width: 100px; + float: left; +} + +.data_right { + width: 100px; + float: right; +} + +.clear { + clear: both; +} + +/* + Debug only: +div { + border: 1px solid #ff0000; +} +*/ -- 2.39.5