]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Introduced setValueInSession() + order.jsp form handler (broken, why?)
authorRoland Haeder <roland@mxchange.org>
Fri, 7 Aug 2015 13:49:41 +0000 (15:49 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 7 Aug 2015 13:49:57 +0000 (15:49 +0200)
Signed-off-by:Roland Häder <roland@mxchange.org>

src/java/org/mxchange/pizzaapplication/application/PizzaApplication.java
src/java/org/mxchange/pizzaapplication/application/PizzaServiceApplication.java
src/java/org/mxchange/pizzaapplication/customer/bean/PizzaServiceCustomerBean.java
web/bye.jsp
web/errorHandler.jsp
web/finished.jsp
web/form_handler/order.jsp [new file with mode: 0644]
web/index.jsp
web/order.jsp [deleted file]
web/preview.jsp [new file with mode: 0644]
web/static/menu.jsp

index 9cc5ba6d20acdd94ba5c8e767fa9c7345941db39..42b02c8f3dd32ecd44dfce558aa91a1bce891f53 100644 (file)
@@ -185,4 +185,13 @@ public interface PizzaApplication extends Application {
         * @return Value from key, empty string for null
         */
        public Object getPrintableValeFromSession (final HttpSession session, final String key);
+
+       /**
+        * Somewhat setter in session
+        *
+        * @param session Session instance
+        * @param key Session key to set
+        * @param value Value to set
+        */
+       public void setValueInSession (final HttpSession session, final String key, final Object value);
 }
index 27afd3217dac325d622534df9734b23db223e7f5..163075e5f5d14f24b917930aefeabcbd05bd9f25 100644 (file)
@@ -304,8 +304,29 @@ public class PizzaServiceApplication extends BasePizzaServiceSystem implements P
 
                synchronized(session) {
                        // Set it synced
-                       this.getLogger().debug(MessageFormat.format("setValueInSession: Setting value={0} for product={1},keyPart={2}", value, product.getName(), keyPart)); //NOI18N
-                       session.setAttribute(String.format(HTTP_PARAM_MASK, product.getName(), keyPart), value);
+                       this.getLogger().debug(MessageFormat.format("Setting value={0} for product={1},keyPart={2}", value, product.getName(), keyPart)); //NOI18N
+                       this.setValueInSession(session, String.format(HTTP_PARAM_MASK, product.getName(), keyPart), value);
+               }
+
+               // Trace message
+               this.getLogger().trace("EXIT!"); //NOI18N
+       }
+
+       /**
+        * Somewhat setter in session
+        *
+        * @param session Session instance
+        * @param key Session key to set
+        * @param value Value to set
+        */
+       @Override
+       public void setValueInSession (final HttpSession session, final String key, final Object value) {
+               // Trace message
+               this.getLogger().trace(MessageFormat.format("session={0},key={1},value={2} - CALLED!", session, key, value)); //NOI18N
+
+               synchronized(session) {
+                       // Set it synced
+                       session.setAttribute(key, value);
                }
 
                // Trace message
index 98a5a6a9d2e0ce0fc583a7e26c7bad1f3dedb951..3b7de4c2f73375a8ba428aec4bca92a50fdf6eb4 100644 (file)
@@ -39,6 +39,9 @@ public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements
                // Instance customer
                Contact customer = new PizzaServiceCustomer();
 
+               // Fake gender
+               customer.setGender(Gender.UNKNOWN);
+
                // And set it here
                this.setContact(customer);
        }
@@ -164,13 +167,13 @@ public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements
        }
 
        @Override
-       public long getHouseNumber () {
+       public Long getHouseNumber () {
                // Deligate to "hidden" object
                return this.getContact().getHouseNumber();
        }
 
        @Override
-       public void setHouseNumber (final long houseNumber) {
+       public void setHouseNumber (final Long houseNumber) {
                // Deligate to "hidden" object
                this.getContact().setHouseNumber(houseNumber);
        }
@@ -218,13 +221,13 @@ public class PizzaServiceCustomerBean extends BasePizzaServiceSystem implements
        }
 
        @Override
-       public long getZipCode () {
+       public Long getZipCode () {
                // Deligate to "hidden" object
                return this.getContact().getZipCode();
        }
 
        @Override
-       public void setZipCode (final long zipCode) {
+       public void setZipCode (final Long zipCode) {
                // Deligate to "hidden" object
                this.getContact().setZipCode(zipCode);
        }
index f58324ef1bb7cde4faf29fbe799591167e2225c7..acf5b790ec8292fccf24756a7e3ec77d83e967d0 100644 (file)
@@ -21,7 +21,7 @@
                </div>
 
                <div id="menu">
-                       <jsp:include page="static/menu.jsp" flush="true" />
+                       <jsp:include page="/static/menu.jsp" flush="true" />
                </div>
 
                <div id="content_outer">
index 813977e0fa19bd9cf837b43ce064aaddce2bb18d..0f45fade48a1acdd089a23cd8bf3ccb0da6899d6 100644 (file)
@@ -9,7 +9,9 @@
 <%@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" %>
-<jsp:useBean id="date" class="java.util.Date" /><%
+<jsp:useBean id="date" class="java.util.Date" />
+
+<%
        // Init application instance
        PizzaApplication app = PizzaServiceApplication.getInstance(application);
 %>
@@ -27,7 +29,7 @@
                </div>
 
                <div id="menu">
-                       <jsp:include page="static/menu.jsp" flush="true" />
+                       <jsp:include page="/static/menu.jsp" flush="true" />
                </div>
 
                <div id="content_outer">
index ab7d949842e876e49a6e5a5ba58198766edb27c3..012a8282b2aded8b2c842be999b9d183fb324b34 100644 (file)
@@ -4,10 +4,10 @@
        Author     : Roland Haeder
 --%>
 
-<%@page import="java.lang.reflect.Field"%>
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
 
+<%@page import="java.lang.reflect.Field"%>
 <%@page import="java.util.Map"%>
 <%@page import="java.util.Iterator"%>
 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
@@ -15,7 +15,7 @@
 <%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
 
-<jsp:useBean id="customer" scope="request" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
+<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
 <jsp:setProperty name="customer" property="*" />
 
 <%
@@ -36,7 +36,7 @@
                </div>
 
                <div id="menu">
-                       <jsp:include page="static/menu.jsp" flush="true" />
+                       <jsp:include page="/static/menu.jsp" flush="true" />
                </div>
 
                <div id="content_outer">
                                                                        %>
                                                                        <li><%=entry.getKey().getName()%> set to: <%=entry.getValue()%></li>
                                                                        <%
-                                                                       // Set it in session
-                                                                       synchronized (session) {
-                                                                               session.setAttribute(entry.getKey().getName(), entry.getValue());
-                                                                       }
                                                                }
                                                                %>
                                                                </ul>
diff --git a/web/form_handler/order.jsp b/web/form_handler/order.jsp
new file mode 100644 (file)
index 0000000..926b2e5
--- /dev/null
@@ -0,0 +1,71 @@
+<%-- 
+       Document   : order
+       Created on : 07.08.2015, 14:58:21
+       Author     : Roland Haeder
+--%>
+
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+<%@page import="java.lang.reflect.Field"%>
+<%@page import="java.util.Map"%>
+<%@page import="java.util.Iterator"%>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+
+<jsp:useBean id="customer" scope="request" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
+<jsp:setProperty name="customer" property="*" />
+
+<%
+       // Init application instance
+       PizzaApplication app = PizzaServiceApplication.getInstance(application);
+
+       // Is it post?
+       if ("POST".equals(request.getMethod())) {
+               // Is POST, so continue with handling
+               Iterator<Map.Entry<Field, Object>> fieldIterator = customer.iterator();
+
+               while (fieldIterator.hasNext()) {
+                       Map.Entry<Field, Object> entry = fieldIterator.next();
+
+                       // Debug message
+                       app.getLogger().debug("entry " + entry.getKey() + "=" + entry.getValue());
+
+                       // Set it in session
+                       app.setValueInSession(session, entry.getKey().getName(), entry.getValue());
+               }
+
+               // Redirect to proper URL
+               //response.sendRedirect(request.getContextPath() + "/finished.jsp");
+       }
+%>
+<jsp:forward page="../finished.jsp" />
+
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <link rel="stylesheet" href="style.css" type="text/css"/>
+               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+       </head>
+
+       <body>
+               <div id="title">
+                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+               </div>
+
+               <div id="menu">
+                       <jsp:include page="/static/menu.jsp" flush="true" />
+               </div>
+
+               <div id="content_outer">
+                       <div id="content_title">
+                               <h2>Bitte nicht direkt aufrufen:</h2>
+                       </div>
+
+                       <div id="content">
+                               Bitte rufen Sie diese Seite nicht direkt auf.
+                       </div>
+               </div>
+       </body>
+</html>
index d2c0ea7fad9894a8a49dcaa292ef516ede960c1e..d293fa266dc974fcdb42cf99ccc9056341aaf29a 100644 (file)
@@ -30,7 +30,7 @@
                </div>
 
                <div id="menu">
-                       <jsp:include page="static/menu.jsp" flush="true" />
+                       <jsp:include page="/static/menu.jsp" flush="true" />
                </div>
 
                <div id="content_outer">
@@ -39,7 +39,7 @@
                        </div>
 
                        <div id="content">
-                               <form action="<%=request.getContextPath()%>/order.jsp" accept-charset="utf-8" id="form" method="post">
+                               <form action="<%=request.getContextPath()%>/preview.jsp" accept-charset="utf-8" id="form" method="post">
                                <table class="table">
                                        <thead class="table_header">
                                                <tr>
diff --git a/web/order.jsp b/web/order.jsp
deleted file mode 100644 (file)
index 35d6ec2..0000000
+++ /dev/null
@@ -1,274 +0,0 @@
-<%-- 
-       Document   : order
-       Created on : 04.08.2015, 10:55:10
-       Author     : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="java.util.Iterator"%>
-<%@page import="java.util.Map"%>
-<%@page import="org.mxchange.jcore.contact.Gender"%>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-
-<jsp:setProperty name="customer" property="*" />
-
-<%
-       // Init application instance
-       PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
-       <head>
-               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
-               <link rel="stylesheet" href="style.css" type="text/css"/>
-               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</title>
-       </head>
-
-       <body>
-               <div id="title">
-                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</h1>
-               </div>
-
-               <div id="menu">
-                       <jsp:include page="static/menu.jsp" flush="true" />
-               </div>
-
-               <div id="content_outer">
-                       <div id="content_title">
-                               <h2>Folgendes möchten Sie bestellen:</h2>
-                       </div>
-
-                       <div id="content">
-                               <form action="<%=request.getContextPath()%>/finished.jsp" accept-charset="utf-8" id="form" method="post">
-                               <table class="table">
-                                       <thead class="table_header">
-                                               <tr>
-                                                       <th class="table_header_column">
-                                                               Bestellen?
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Anzahl:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Produkt:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Einzelpreis:
-                                                       </th>
-                                                       <th class="table_header_column">
-                                                               Zwischensumme:
-                                                       </th>
-                                               </tr>
-                                       </thead>
-                                       <tbody class="table_body">
-                                               <%
-                                               // Get iterator from products
-                                               Iterator<Map.Entry<String, Product>> iterator = app.getProductsIterator();
-
-                                               // Iterate over all
-                                               while (iterator.hasNext()) {
-                                                       // Get entry
-                                                       Map.Entry<String, Product> entry = iterator.next();
-
-                                                       // Get product
-                                                       Product product = entry.getValue();
-                                                       %>
-                                                       <tr>
-                                                               <td>
-                                                                       <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
-                                                               </td>
-                                                               <td>
-                                                                       <%=app.handleAmountFromRequestSession(product, request, session)%>
-                                                               </td>
-                                                               <td>
-                                                                       <%=product.getTitle()%>
-                                                               </td>
-                                                               <td>
-                                                                       <%=product.getPrice()%>
-                                                               </td>
-                                                               <td>
-                                                                       <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
-                                                               </td>
-                                                       </tr>
-                                                       <%
-                                                       // Is it choosen and amount set?
-                                                       if (app.isProductChoosen(product, request, session)) {
-                                                               // Then mark it as choosen
-                                                               product.markAsChoosen();
-                                                               app.unmarkProductAsOrdered(product, session);
-                                                       }
-                                               }
-                                               %>
-                                               <tr>
-                                                       <td id="table_total_amount_left">
-                                                               Menge:
-                                                       </td>
-                                                       <td id="table_total_amount_right">
-                                                               <%=app.calculateTotalAmount(request, session)%>
-                                                       </td>
-                                                       <td class="spacer">
-                                                               &nbsp;
-                                                       </td>
-                                                       <td id="table_total_sum_left">
-                                                               Gesamtpreis:
-                                                       </td>
-                                                       <td id="table_total_sum_right">
-                                                               <%=app.calculateTotalPrice(request, session)%>
-                                                       </td>
-                                               </tr>
-
-                                               <tr>
-                                                       <td colspan="5">
-                                                               <fieldset>
-                                                                       <legend title="Bitte geben Sie Ihre Daten ein.">Bitte Ihre Daten eingeben:</legend>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="gender">Anrede</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <select name="gender" id="gender" size="1">
-                                                                                               <%
-                                                                                               Gender[] genders = Gender.values();
-                                                                                               for (final Gender gender : genders) {
-                                                                                                       %>
-                                                                                                       <option value="<%=gender.name()%>"<%
-                                                                                                       synchronized (session) {
-                                                                                                               // Get session value
-                                                                                                               Object value = session.getAttribute("gender");
-                                                                                                               if ((value instanceof Gender) && (value.equals(gender))) {
-                                                                                                                       // Output selected="selected"
-                                                                                                                       out.print("selected=\"selected\"");
-                                                                                                               }
-                                                                                                       }
-                                                                                                       %>><%=gender%></option>
-                                                                                                       <%
-                                                                                               }
-                                                                                               %> 
-                                                                                       </select>
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="companyname">Firmenname:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="companyname" name="companyname" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "companyname")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="surname">Vorname:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="surname" name="surname" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "surname")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="familyname">Nachname:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="familyname" name="familyname" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "familyname")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="street">Straße:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="street" name="street" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "street")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="houseNumber">Hausnummer:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="houseNumber" name="houseNumber" size="3" maxlength="5" value="<%=app.getPrintableValeFromSession(session, "houseNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="zipCode">Postleitzahl:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="zipCode" name="zipCode" size="5" maxlength="6" value="<%=app.getPrintableValeFromSession(session, "zipCode")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="city">Ort:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="city" name="city" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "city")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="phoneNumber">Telefon:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="phoneNumber" name="phoneNumber" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "phoneNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="faxNumber">Faxnummer:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="faxNumber" name="faxNumber" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "faxNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-
-                                                                       <div class="data_row">
-                                                                               <div class="data_left">
-                                                                                       <label for="cellphoneNumber">Handy:</label>
-                                                                               </div>
-                                                                               <div class="data_right">
-                                                                                       <input type="text" id="cellphoneNumber" name="cellphoneNumber" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "cellphoneNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                                               </div>
-                                                                               <div class="clear"></div>
-                                                                       </div>
-                                                               </fieldset>
-                                                       </td>
-                                               </tr>
-
-                                               <tr>
-                                                       <td colspan="5" class="table_footer">
-                                                               <input type="reset" value="Formular zurücksetzen" />
-                                                               <input type="submit" name="send" value="Bestellung abschliessen" <%=app.getDisabledHtmlFromSession(request, session)%> />
-                                                       </td>
-                                               </tr>
-                                       </tbody>
-                               </table>
-                               </form>
-                       </div>
-               </div>
-       </body>
-</html>
diff --git a/web/preview.jsp b/web/preview.jsp
new file mode 100644 (file)
index 0000000..afebc53
--- /dev/null
@@ -0,0 +1,274 @@
+<%-- 
+       Document   : order
+       Created on : 04.08.2015, 10:55:10
+       Author     : Roland Haeder
+--%>
+
+<%--<%@page errorPage="errorHandler.jsp" %>--%>
+<%@page import="java.util.Iterator"%>
+<%@page import="java.util.Map"%>
+<%@page import="org.mxchange.jcore.contact.Gender"%>
+<%@page import="org.mxchange.pizzaapplication.product.Product"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
+<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
+<%@page contentType="text/html" pageEncoding="UTF-8"%>
+
+<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
+
+<jsp:setProperty name="customer" property="*" />
+
+<%
+       // Init application instance
+       PizzaApplication app = PizzaServiceApplication.getInstance(application);
+%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
+       <head>
+               <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+               <link rel="stylesheet" href="style.css" type="text/css"/>
+               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</title>
+       </head>
+
+       <body>
+               <div id="title">
+                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</h1>
+               </div>
+
+               <div id="menu">
+                       <jsp:include page="/static/menu.jsp" flush="true" />
+               </div>
+
+               <div id="content_outer">
+                       <div id="content_title">
+                               <h2>Folgendes möchten Sie bestellen:</h2>
+                       </div>
+
+                       <div id="content">
+                               <form action="<%=request.getContextPath()%>/form_handler/order.jsp" accept-charset="utf-8" id="form" method="post">
+                               <table class="table">
+                                       <thead class="table_header">
+                                               <tr>
+                                                       <th class="table_header_column">
+                                                               Bestellen?
+                                                       </th>
+                                                       <th class="table_header_column">
+                                                               Anzahl:
+                                                       </th>
+                                                       <th class="table_header_column">
+                                                               Produkt:
+                                                       </th>
+                                                       <th class="table_header_column">
+                                                               Einzelpreis:
+                                                       </th>
+                                                       <th class="table_header_column">
+                                                               Zwischensumme:
+                                                       </th>
+                                               </tr>
+                                       </thead>
+                                       <tbody class="table_body">
+                                               <%
+                                               // Get iterator from products
+                                               Iterator<Map.Entry<String, Product>> iterator = app.getProductsIterator();
+
+                                               // Iterate over all
+                                               while (iterator.hasNext()) {
+                                                       // Get entry
+                                                       Map.Entry<String, Product> entry = iterator.next();
+
+                                                       // Get product
+                                                       Product product = entry.getValue();
+                                                       %>
+                                                       <tr>
+                                                               <td>
+                                                                       <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
+                                                               </td>
+                                                               <td>
+                                                                       <%=app.handleAmountFromRequestSession(product, request, session)%>
+                                                               </td>
+                                                               <td>
+                                                                       <%=product.getTitle()%>
+                                                               </td>
+                                                               <td>
+                                                                       <%=product.getPrice()%>
+                                                               </td>
+                                                               <td>
+                                                                       <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
+                                                               </td>
+                                                       </tr>
+                                                       <%
+                                                       // Is it choosen and amount set?
+                                                       if (app.isProductChoosen(product, request, session)) {
+                                                               // Then mark it as choosen
+                                                               product.markAsChoosen();
+                                                               app.unmarkProductAsOrdered(product, session);
+                                                       }
+                                               }
+                                               %>
+                                               <tr>
+                                                       <td id="table_total_amount_left">
+                                                               Menge:
+                                                       </td>
+                                                       <td id="table_total_amount_right">
+                                                               <%=app.calculateTotalAmount(request, session)%>
+                                                       </td>
+                                                       <td class="spacer">
+                                                               &nbsp;
+                                                       </td>
+                                                       <td id="table_total_sum_left">
+                                                               Gesamtpreis:
+                                                       </td>
+                                                       <td id="table_total_sum_right">
+                                                               <%=app.calculateTotalPrice(request, session)%>
+                                                       </td>
+                                               </tr>
+
+                                               <tr>
+                                                       <td colspan="5">
+                                                               <fieldset>
+                                                                       <legend title="Bitte geben Sie Ihre Daten ein.">Bitte Ihre Daten eingeben:</legend>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="gender">Anrede</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <select name="gender" id="gender" size="1">
+                                                                                               <%
+                                                                                               Gender[] genders = Gender.values();
+                                                                                               for (final Gender gender : genders) {
+                                                                                                       %>
+                                                                                                       <option value="<%=gender.name()%>"<%
+                                                                                                       synchronized (session) {
+                                                                                                               // Get session value
+                                                                                                               Object value = session.getAttribute("gender");
+                                                                                                               if ((value instanceof Gender) && (value.equals(gender))) {
+                                                                                                                       // Output selected="selected"
+                                                                                                                       out.print("selected=\"selected\"");
+                                                                                                               }
+                                                                                                       }
+                                                                                                       %>><%=gender%></option>
+                                                                                                       <%
+                                                                                               }
+                                                                                               %> 
+                                                                                       </select>
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="companyname">Firmenname:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="companyname" name="companyname" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "companyname")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="surname">Vorname:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="surname" name="surname" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "surname")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="familyname">Nachname:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="familyname" name="familyname" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "familyname")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="street">Straße:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="street" name="street" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "street")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="houseNumber">Hausnummer:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="houseNumber" name="houseNumber" size="3" maxlength="5" value="<%=app.getPrintableValeFromSession(session, "houseNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="zipCode">Postleitzahl:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="zipCode" name="zipCode" size="5" maxlength="6" value="<%=app.getPrintableValeFromSession(session, "zipCode")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="city">Ort:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="city" name="city" size="10" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "city")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="phoneNumber">Telefon:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="phoneNumber" name="phoneNumber" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "phoneNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="faxNumber">Faxnummer:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="faxNumber" name="faxNumber" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "faxNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+
+                                                                       <div class="data_row">
+                                                                               <div class="data_left">
+                                                                                       <label for="cellphoneNumber">Handy:</label>
+                                                                               </div>
+                                                                               <div class="data_right">
+                                                                                       <input type="text" id="cellphoneNumber" name="cellphoneNumber" size="20" maxlength="255" value="<%=app.getPrintableValeFromSession(session, "cellphoneNumber")%>" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                                               </div>
+                                                                               <div class="clear"></div>
+                                                                       </div>
+                                                               </fieldset>
+                                                       </td>
+                                               </tr>
+
+                                               <tr>
+                                                       <td colspan="5" class="table_footer">
+                                                               <input type="reset" value="Formular zurücksetzen" />
+                                                               <input type="submit" name="send" value="Bestellung abschliessen" <%=app.getDisabledHtmlFromSession(request, session)%> />
+                                                       </td>
+                                               </tr>
+                                       </tbody>
+                               </table>
+                               </form>
+                       </div>
+               </div>
+       </body>
+</html>
index 9459812e23ddcbe1267d13d85f3becf848ab86dc..8136267b3129e3662c2e7dd8c9ac4e3756f5e159 100644 (file)
@@ -6,7 +6,7 @@
 
 <ul>
        <li><a href="<%=request.getContextPath()%>/index.jsp" title="Eingangsseite">Home</a></li>
-       <li><a href="<%=request.getContextPath()%>/order.jsp" title="Bestellseite">Bestellung</a></li>
+       <li><a href="<%=request.getContextPath()%>/preview.jsp" title="Bestellseite">Bestellung</a></li>
        <li><a href="<%=request.getContextPath()%>/finished.jsp" title="Bestellung abgeschlossen">Vielen Dank</a></li>
        <li><a href="<%=request.getContextPath()%>/bye.jsp" title="Sitzung beennden">Sitzung beenden</a></li>
 </ul>