]> git.mxchange.org Git - pizzaservice-war.git/blob - web/form_handler/do_preview.jsp
Continued with project:
[pizzaservice-war.git] / web / form_handler / do_preview.jsp
1 <%-- 
2         Document   : order
3         Created on : 04.08.2015, 10:55:10
4         Author     : Roland Haeder
5 --%>
6
7 <%--<%@page errorPage="errorHandler.jsp" %>--%>
8 <%@page import="java.util.Iterator"%>
9 <%@page import="java.util.Map"%>
10 <%@page import="org.mxchange.jcore.contact.Gender"%>
11 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
12 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
13 <%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
14 <%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
15 <%@page contentType="text/html" pageEncoding="UTF-8"%>
16
17 <%
18         // Init application instance
19         PizzaApplication app = PizzaServiceApplication.getInstance(application);
20
21         // Is it post?
22         if ("POST".equals(request.getMethod())) { //NOI18N
23                 // Get Iterator
24                 Iterator<Product> iterator = app.getAvailableProducts();
25
26                 // "Walk" through all products and unmark them as ordered
27                 while (iterator.hasNext()) {
28                         // Get product instance
29                         Product product = iterator.next();
30
31                         // Mark product as not ordered
32                         app.unmarkProductAsOrdered(product, session);
33
34                         // Is it choosen and amount set?
35                         if (app.isProductChoosen(product, request, session)) {
36                                 // Then mark it as choosen
37                                 app.markProductAsChoosen(product, session);
38                         } else {
39                                 // Unmark it
40                                 app.unmarkProductAsChoosen(product, session);
41                         }
42                 }
43                 // Redirect to proper URL
44                 // @TODO Commented out for developing:
45                 //response.sendRedirect(request.getContextPath() + "/finished.jsp");
46 %>
47 <jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
48 <jsp:setProperty name="customer" property="*" />
49 <jsp:forward page="../preview.jsp" />
50 <%
51         }
52 %>
53 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
54 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
55         <head>
56                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
57                 <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
58                 <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
59         </head>
60
61         <body>
62                 <div id="title">
63                         <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
64                 </div>
65
66                 <jsp:include page="/static/menu.jsp" flush="true" />
67
68                 <div id="content_outer">
69                         <div id="content_title">
70                                 <h2>Bitte nicht direkt aufrufen:</h2>
71                         </div>
72
73                         <div id="content">
74                                 Bitte rufen Sie diese Seite nicht direkt auf.
75                         </div>
76                 </div>
77         </body>
78 </html>