]> git.mxchange.org Git - pizzaservice-war.git/blob - add_item.jsp
582596c818e54471c71c65a6c0cae96d43d7f25a
[pizzaservice-war.git] / add_item.jsp
1 <%-- 
2         Document   : add_item
3         Ceated on : Aug 17, 2015, 7:03:38 PM
4         Author     : Roland Haeder
5 --%>
6
7 <%@page import="org.mxchange.jcore.BaseFrameworkSystem"%>
8 <%--<%@page errorPage="errorHandler.jsp" %>--%>
9 <%@page contentType="text/html" pageEncoding="UTF-8"%>
10 <%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaBean"%>
11 <%@page import="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean"%>
12 <%@page import="org.mxchange.jshop.item.AddableBasketItem"%>
13
14 <jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="PizzaBean" />
15
16 <jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
17 <jsp:setProperty name="controller" property="basket" value="${basket}" />
18
19 <%
20         // TODO: Can be removed later
21         controller.init();
22 %>
23
24 <jsp:useBean id="item" scope="request" class="org.mxchange.jshop.item.basket.BasketItem" type="AddableBasketItem" />
25 <jsp:setProperty name="item" property="*" />
26
27 <%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
28 <c:set var="basePath" value="${pageContext.request.contextPath}" />
29
30 <%
31         // Get amount from item
32         Long amount = item.getAmount();
33
34         // Debug message
35         BaseFrameworkSystem.getInstance().getLogger().debug("amount=" + amount);
36
37         // Is amount null or zero?
38         if ((null == amount) || (amount == 0)) {
39                 // Then redirect to added=0
40                 response.sendRedirect(request.getContextPath() + "/?add=0");
41         } else {
42                 // Redirect to proper URL
43                 response.sendRedirect(request.getContextPath() + "/?add=1");
44         }
45 %>
46
47 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
48 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de" lang="de">
49         <head>
50                 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
51                 <link rel="stylesheet" href="${basePath}/style.css" type="text/css"/>
52                 <title>Pizza-Service - Form-Handler</title>
53         </head>
54
55         <body>
56                 <div id="title">
57                         <h1>Pizza-Service - Form-Handler</h1>
58                 </div>
59
60                 <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
61
62                 <jsp:include page="/static/error/direct_call.jsp" flush="false" />
63
64                 <jsp:include page="/static/guest/guest_footer.jsp" flush="false" />
65         </body>
66 </html>