]> git.mxchange.org Git - pizzaservice-war.git/blobdiff - web/form_handler/add_item.jsp
Continued with project:
[pizzaservice-war.git] / web / form_handler / add_item.jsp
index aa17cca551f50a208b539a404cbec65dd7ff2b7c..d5638079ca2cd838a98c437aadabca9df38cda5c 100644 (file)
@@ -4,40 +4,56 @@
        Author     : Roland Haeder
 --%>
 
+<%@page import="org.mxchange.jcore.BaseFrameworkSystem"%>
 <%--<%@page errorPage="errorHandler.jsp" %>--%>
 <%@page contentType="text/html" pageEncoding="UTF-8"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaBean"%>
+<%@page import="org.mxchange.pizzaapplication.beans.PizzaServiceBean"%>
 <%@page import="org.mxchange.pizzaapplication.item.AddableBasketItem"%>
 
-<jsp:useBean id="item" scope="session" class="org.mxchange.pizzaapplication.item.basket.BasketItem" type="AddableBasketItem" />
+<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.PizzaServiceBean" type="org.mxchange.pizzaapplication.beans.PizzaBean" />
+
+<jsp:setProperty name="controller" property="application" value="${pageContext.servletContext}" />
+<jsp:setProperty name="controller" property="basket" value="${basket}" />
+<%controller.init();%>
+
+<jsp:useBean id="item" scope="request" class="org.mxchange.pizzaapplication.item.basket.BasketItem" type="AddableBasketItem" />
 <jsp:setProperty name="item" property="*" />
 
 <%
-       // Init application instance
-       PizzaApplication app = PizzaServiceApplication.getInstance(application);
-
-       // Redirect to proper URL
-       // @TODO Commented out for debugging
-       //response.sendRedirect(request.getContextPath() + "/?add=1");
+       // Get amount from item
+       Long amount = item.getAmount();
+
+       // Debug message
+       BaseFrameworkSystem.getInstance().getLogger().debug("amount=" + amount);
+
+       // Is amount null or zero?
+       if ((null == amount) || (amount == 0)) {
+               // Then redirect to added=0
+               response.sendRedirect(request.getContextPath() + "/?add=0");
+       } else {
+               // Redirect to proper URL
+               response.sendRedirect(request.getContextPath() + "/?add=1");
+       }
 %>
-<jsp:forward page="../index.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="<%=request.getContextPath()%>/style.css" type="text/css"/>
-               <title><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</title>
+               <title>Pizza-Service - Form-Handler</title>
        </head>
 
        <body>
                <div id="title">
-                       <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Form-Handler</h1>
+                       <h1>Pizza-Service - Form-Handler</h1>
                </div>
 
-               <jsp:include page="/static/menu.jsp" flush="false" />
+               <jsp:include page="/static/guest/guest_menu.jsp" flush="false" />
 
                <jsp:include page="/static/error/direct_call.jsp" flush="false" />
+
+               <jsp:include page="/static/guest/guest_footer.jsp" flush="false" />
        </body>
 </html>