* @param value Value to set
*/
public void setValueInSession (final HttpSession session, final String key, final Object value);
+
+ /**
+ * Some "getter" for a an array of unmarked products
+ *
+ * @param session HttpSession instance
+ * @return Unmarked products
+ */
+ public Product[] getUnmarkedProducts (final HttpSession session);
+
+ /**
+ * Some "getter" for a an array of all products
+ *
+ * @return Unmarked products
+ */
+ public Product[] getProducts ();
}
// Return actual value
return this.convertNullToEmpty(value);
}
+
+ /**
+ * Gets an array of products from product iterator and unmarks them as ordered
+ *
+ * @param session HttpSession instance
+ * @return Unmarked products
+ */
+ @Override
+ public Product[] getUnmarkedProducts (final HttpSession session) {
+ // Init array
+ Product[] array = this.getProducts();
+
+ // Unmark are all as ordered
+ for (final Product product : array) {
+ this.unmarkProductAsOrdered(product, session);
+ }
+
+ // Return finished array
+ return array;
+ }
+
+ /**
+ * Some "getter" for a an array of all products
+ *
+ * @return Unmarked products
+ */
+ @Override
+ public Product[] getProducts () {
+ return (Product[]) this.products.values().toArray();
+ }
}
<h1><%=PizzaServiceApplication.MAIN_TITLE%> - Sitzung beenden</h1>
</div>
- <div id="menu">
- <jsp:include page="/static/menu.jsp" flush="true" />
- </div>
+ <jsp:include page="/static/menu.jsp" flush="true" />
<div id="content_outer">
<div id="content_title">
<h1><%=PizzaServiceApplication.MAIN_TITLE%> - Fehler</h1>
</div>
- <div id="menu">
- <jsp:include page="/static/menu.jsp" flush="true" />
- </div>
+ <jsp:include page="/static/menu.jsp" flush="true" />
<div id="content_outer">
<div id="content_title">
<h1><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</h1>
</div>
- <div id="menu">
- <jsp:include page="/static/menu.jsp" flush="true" />
- </div>
+ <jsp:include page="/static/menu.jsp" flush="true" />
<div id="content_outer">
<div id="content_title">
<h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
</div>
- <div id="menu">
- <jsp:include page="/static/menu.jsp" flush="true" />
- </div>
+ <jsp:include page="/static/menu.jsp" flush="true" />
<div id="content_outer">
<div id="content_title">
<h1><%=PizzaServiceApplication.MAIN_TITLE%> - Eingangsseite</h1>
</div>
- <div id="menu">
- <jsp:include page="/static/menu.jsp" flush="true" />
- </div>
+ <jsp:include page="/static/menu.jsp" flush="true" />
<div id="content_outer">
<div id="content_title">
<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();
- app.unmarkProductAsOrdered(product, session);
+ // Much smaller loop
+ for (final Product product : app.getUnmarkedProducts(session)) {
%>
<tr>
<td>
<h1><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</h1>
</div>
- <div id="menu">
- <jsp:include page="/static/menu.jsp" flush="true" />
- </div>
+ <jsp:include page="/static/menu.jsp" flush="true" />
<div id="content_outer">
<div id="content_title">
</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();
+ for (final Product product : app.getProducts()) {
%>
<tr>
<td>
Author : Roland Haeder
--%>
-<ul>
- <li><a href="<%=request.getContextPath()%>/index.jsp" title="Eingangsseite">Home</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>
+<div id="menu">
+ <ul>
+ <li><a href="<%=request.getContextPath()%>/index.jsp" title="Eingangsseite">Home</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>
+</div>