3 Created on : 04.08.2015, 10:33:10
7 <%--<%@page errorPage="errorHandler.jsp" %>--%>
8 <%@page import="java.util.Map"%>
9 <%@page import="java.util.Iterator"%>
10 <%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
11 <%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
12 <%@page import="org.mxchange.pizzaapplication.product.Product"%>
13 <%@page import="org.mxchange.pizzaapplication.basket.Basket"%>
14 <%@page import="org.mxchange.pizzaapplication.basket.item.ItemBasket"%>
15 <%@page import="org.mxchange.pizzaapplication.item.basket.BasketItem"%>
16 <%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
17 <%@page contentType="text/html" pageEncoding="UTF-8"%>
18 <%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
21 // Init application instance
22 PizzaApplication app = PizzaServiceApplication.getInstance(application);
24 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
25 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
27 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
28 <link rel="stylesheet" href="<%=request.getContextPath()%>/style.css" type="text/css"/>
29 <title><%=PizzaServiceApplication.MAIN_TITLE%> - Willkommen</title>
35 <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Willkommen</h1>
39 <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
41 <div id="content_outer">
42 <div id="content_title">
43 <h2>Folgendes kann bestellt werden:</h2>
49 <th class="table_header_column">
52 <th class="table_header_column">
55 <th class="table_header_column">
58 <th class="table_header_column">
66 Iterator<Product> iterator = app.getAvailableProducts();
68 // "Walk" through all products and unmark them as ordered
69 while (iterator.hasNext()) {
70 // Get product instance
71 Product product = iterator.next();
73 // Get basket instance
74 Basket<AddableBasketItem> basket = ItemBasket.getInstance(session);
76 // Create an item instance form this product
77 AddableBasketItem item = basket.getItem(product);
79 // Has it been already added to the basket?
81 // Some nice output ...
86 <td class="table_data_column">
87 <a href="<%=request.getContextPath()%>/basket.jsp" title="Zum Warenkorb">Warenkorb</a>
89 <td class="table_data_column">
92 <td class="table_data_column">
93 <%=product.getTitle()%>
95 <td class="table_data_column" align="right">
96 <fmt:formatNumber type="currency"><%=product.getPrice()%></fmt:formatNumber>
102 // Then skip this item
107 app.unmarkProductAsOrdered(product, session);
109 <form action="<%=request.getContextPath()%>/form_handler/add_item.jsp" accept-charset="utf-8" id="form" method="post">
110 <table class="table">
113 <td class="table_data_column">
114 <input class="submit" type="submit" name="add" value="Hinzufügen" />
115 <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_ID%>" value="<%=product.getId()%>" />
116 <input class="input" type="hidden" name="<%=PizzaApplication.HTTP_PARAM_ITEM_TYPE%>" value="Product" />
118 <td class="table_data_column">
119 <input class="input" type="text" name="<%=PizzaApplication.HTTP_PARAM_AMOUNT%>" size="3" maxlength="20" />
121 <td class="table_data_column">
122 <%=product.getTitle()%>
124 <td class="table_data_column" align="right">
125 <fmt:formatNumber type="currency"><%=product.getPrice()%></fmt:formatNumber>
137 <jsp:include page="/static/guest/guest_footer.jsp" flush="false" />