j2ee.copy.static.files.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.5
-j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar
+j2ee.platform.classpath=${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/endorsed/javax.annotation-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar:${j2ee.server.home}/modules/javax.batch-api.jar:${j2ee.server.home}/modules/javax.security.auth.message-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.transaction-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.interceptor-api.jar:${j2ee.server.home}/modules/javax.inject.jar:${j2ee.server.home}/modules/javax.resource-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent-api.jar:${j2ee.server.home}/modules/javax.el.jar:${j2ee.server.home}/modules/javax.ejb-api.jar:${j2ee.server.home}/modules/javax.xml.rpc-api.jar:${j2ee.server.home}/modules/javax.security.jacc-api.jar:${j2ee.server.home}/modules/javax.json.jar:${j2ee.server.home}/modules/javax.xml.registry-api.jar:${j2ee.server.home}/modules/javax.websocket-api.jar:${j2ee.server.home}/modules/javax.management.j2ee-api.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.jms-api.jar:${j2ee.server.home}/modules/javax.enterprise.concurrent.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/javax.enterprise.deploy-api.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.ws.rs-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/javax.persistence.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
-j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
-j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
+j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
+j2ee.platform.wsimport.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api.jar
j2ee.platform.wsit.classpath=
j2ee.server.type=gfv3ee6
jar.compress=false
throw new NullPointerException("product is null");
}
+ // Debug message
+ this.getLogger().debug("Product " + product.getTitle() + " has id " + product.getId());
+
// Get item instance from map by product's id number (both are the same)
AddableBasketItem item = this.items.get(product.getId());
- // Trace message
- this.getLogger().trace(MessageFormat.format("item={0} - EXIT!", item));
+ // Is it null?
+ if (item == null) {
+ // Trace message
+ this.getLogger().trace("item=null - EXIT!");
+ } else {
+ // Trace message
+ this.getLogger().trace(MessageFormat.format("item={0} with id={1},amount={2} - EXIT!", item, item.getId(), item.getAmount()));
+ }
// Return it
return item;
// Call doFilter to move on
chain.doFilter(request, response);
- // Get session instance
- HttpSession session = ((HttpServletRequest) request).getSession();
-
- // Debug message
- this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
-
- // Should not be null
- if (session == null) {
- // session is null
- throw new NullPointerException("session is null"); //NOI18N
- }
-
- // Get item instance
- Object object = session.getAttribute("item"); //NOI18N
+ // Get item instance from request
+ Object object = request.getAttribute("item"); //NOI18N
// Debug message
this.getLogger().debug(MessageFormat.format("object={0}", object)); //NOI18N
// Now it is secure to cast
AddableBasketItem item = (AddableBasketItem) object;
- // Get basket instance
+ // Init instance
Basket<AddableBasketItem> basket;
try {
+ // Get session instance
+ HttpSession session = ((HttpServletRequest) request).getSession();
+
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
+
+ // Should not be null
+ if (session == null) {
+ // session is null
+ throw new NullPointerException("session is null"); //NOI18N
+ }
+
+ // Get basket instance
basket = ItemBasket.getInstance(session);
} catch (final UnsupportedDatabaseBackendException | SQLException ex) {
// Continue to throw
}
// Is the item already added?
- if (basket.isItemAdded(item)) {
+ if ((item.getAmount() == null) || (item.getAmount() == 0)) {
+ // Debug message
+ this.getLogger().debug("Amount for item " + item + " is null");
+
+ // Amount is not entered
+ return;
+ } else if (basket.isItemAdded(item)) {
// Yes, then throw exception here
throw new ServletException(MessageFormat.format("item id={0} has already been added.", item.getId()));
}
+++ /dev/null
-<%--
- Document : finished
- Created on : 04.08.2015, 10:55:47
- Author : Roland Haeder
---%>
-
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<%@page import="java.lang.reflect.Field"%>
-<%@page import="java.util.Map"%>
-<%@page import="java.util.Iterator"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:setProperty name="customer" property="*" />
-
-<%
- // Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
-<!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%> - Vielen Dank!</title>
- </head>
-
- <body>
- <div id="header">
- <div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Vielen Dank!</h1>
- </div>
- </div>
-
- <jsp:include page="/static/menu.jsp" flush="false" />
-
- <div id="content_outer">
- <div id="content_title">
- <h2>Folgendes haben Sie bestellt:</h2>
- </div>
-
- <div id="content">
- <table class="table">
- <thead>
- <tr>
- <th class="table_header_column">
- Bestellen?
- </th>
- <th class="table_header_column">
- Anzahl:
- </th>
- <th class="table_header_column">
- Produkt:
- </th>
- <th class="table_header_column">
- Einzelpreis:
- </th>
- <th class="table_header_column">
- Zwischensumme:
- </th>
- </tr>
- </thead>
- <tbody>
- <%
- // Get Iterator
- Iterator<Product> iterator = app.getAvailableProducts();
-
- // "Walk" through all products and unmark them as ordered
- while (iterator.hasNext()) {
- // Get product instance
- Product product = iterator.next();
- %>
- <tr>
- <td>
- <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
- </td>
- <td>
- <%=app.handleAmountFromRequestSession(product, request, session)%>
- </td>
- <td>
- <%=product.getTitle()%>
- </td>
- <td>
- <%=product.getPrice()%>
- </td>
- <td align="right">
- <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
- </td>
- </tr>
- <%
- }
- %>
- <tr>
- <td id="table_total_amount_left">
- Menge:
- </td>
- <td id="table_total_amount_right">
- <%=app.calculateTotalAmount(request, session)%>
- </td>
- <td>
-
- </td>
- <td id="table_total_sum_left">
- Gesamtpreis:
- </td>
- <td id="table_total_sum_right" align="right">
- <%=app.calculateTotalPrice(request, session)%>
- </td>
- </tr>
-
- <tr>
- <td colspan="5" class="table_header">
- Ihre Daten:
- </td>
- </tr>
-
- <tr>
- <td colspan="5" class="table_row">
- <%
- // Debug message
- app.getLogger().debug("customer=" + customer);
-
- // Get iterator on all fields/attributes
- Iterator<Map.Entry<Field, Object>> fieldIterator = customer.iterator();
- %>
- <ul>
- <%
- while (fieldIterator.hasNext()) {
- Map.Entry<Field, Object> entry = fieldIterator.next();
- %>
- <li><%=entry.getKey().getName()%> set to: <%=entry.getValue()%></li>
- <%
- }
- %>
- </ul>
- </td>
- </tr>
-
- <tr>
- <td colspan="5" class="table_footer">
- <%
- if (("POST".equals(request.getMethod())) && (app.calculateTotalAmount(request, session) > 0)) {
- out.print("Ihre Bestellung ist eingegangen.");
- synchronized(session) {
- //session.invalidate();
- out.print("<div>Zu Demo-Zwecken wird die Sitzung nicht gekillt. Bitte 'Bestellung' aufrufen, um zu gucken, dass die Daten da sind.</div>");
- }
- } else {
- // Nothing ordered
- out.print("Keine Bestellung aufgegeben.");
- }
- %>
- </td>
- </tr>
- </tbody>
- </table>
- </div>
- </div>
-
- <jsp:include page="/static/footer.jsp" flush="false" />
- </body>
-</html>
<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
<%@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="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
- response.sendRedirect(request.getContextPath() + "/?add=1");
+ // Get amount from item
+ Long amount = item.getAmount();
+
+ // Debug message
+ app.getLogger().debug("amount=" + amount);
+
+ // Is amount null or zero?
+ if ((amount == null) || (amount == 0)) {
+ // Then redirect to added=0
+ response.sendRedirect(request.getContextPath() + "/?add=0");
+ } else {
+ // Redirect to proper URL
+ response.sendRedirect(request.getContextPath() + "/?add=1");
+ }
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<jsp:include page="/static/menu.jsp" flush="false" />
<jsp:include page="/static/error/direct_call.jsp" flush="false" />
+
+ <jsp:include page="/static/footer.jsp" flush="false" />
</body>
</html>
+++ /dev/null
-<%--
- Document : preview
- Created on : 04.08.2015, 10:55:10
- Author : Roland Haeder
---%>
-
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<%--<%@page errorPage="errorHandler.jsp" %>--%>
-<%@page import="java.util.Iterator"%>
-<%@page import="java.util.Map"%>
-<%@page import="org.mxchange.jcore.contact.Gender"%>
-<%@page import="org.mxchange.pizzaapplication.product.Product"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaApplication"%>
-<%@page import="org.mxchange.pizzaapplication.application.PizzaServiceApplication"%>
-<%@page import="org.mxchange.pizzaapplication.beans.CustomerBean" %>
-<%@page contentType="text/html" pageEncoding="UTF-8"%>
-
-<jsp:useBean id="customer" scope="session" class="org.mxchange.pizzaapplication.customer.bean.PizzaServiceCustomerBean" type="CustomerBean" />
-<jsp:setProperty name="customer" property="*" />
-
-<%
- // Init application instance
- PizzaApplication app = PizzaServiceApplication.getInstance(application);
-%>
-<!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%> - Bestellung anzeigen</title>
- </head>
-
- <body>
- <div id="header">
- <div id="title">
- <h1><%=PizzaServiceApplication.MAIN_TITLE%> - Bestellung anzeigen</h1>
- </div>
- </div>
-
- <jsp:include page="/static/menu.jsp" flush="false" />
-
- <div id="content_outer">
- <div id="content_title">
- <h2>Folgendes möchten Sie bestellen:</h2>
- </div>
-
- <div id="content">
- <form action="<%=request.getContextPath()%>/form_handler/do_order.jsp" accept-charset="utf-8" id="form" method="post">
- <table class="table">
- <thead>
- <tr>
- <th class="table_header_column">
- Bestellen?
- </th>
- <th class="table_header_column">
- Anzahl:
- </th>
- <th class="table_header_column">
- Produkt:
- </th>
- <th class="table_header_column">
- Einzelpreis:
- </th>
- <th class="table_header_column">
- Zwischensumme:
- </th>
- </tr>
- </thead>
- <tbody>
- <%
- // Get Iterator
- Iterator<Product> iterator = app.getAvailableProducts();
-
- // "Walk" through all products and unmark them as ordered
- while (iterator.hasNext()) {
- // Get product instance
- Product product = iterator.next();
-
- // Unmark it as ordered
- app.unmarkProductAsOrdered(product, session);
- %>
- <tr>
- <td>
- <%=app.getPrintableChoosenFromRequestSession(product, request, session)%>
- </td>
- <td>
- <%=app.handleAmountFromRequestSession(product, request, session)%>
- </td>
- <td>
- <%=product.getTitle()%>
- </td>
- <td>
- <%=product.getPrice()%>
- </td>
- <td align="right">
- <%=app.getTotalPositionPriceFromRequestSession(product, request, session)%>
- </td>
- </tr>
- <%
- // Is it choosen and amount set?
- if (app.isProductChoosen(product, request, session)) {
- // Then mark it as choosen
- app.markProductAsChoosen(product, session);
- }
- }
- %>
- <tr>
- <td id="table_total_amount_left">
- Menge:
- </td>
- <td id="table_total_amount_right">
- <%=app.calculateTotalAmount(request, session)%>
- </td>
- <td>
-
- </td>
- <td id="table_total_sum_left">
- Gesamtpreis:
- </td>
- <td id="table_total_sum_right" align="right">
- <%=app.calculateTotalPrice(request, session)%>
- </td>
- </tr>
-
- <tr>
- <td colspan="5">
- <%-- @TODO Add navigation to login and registration form --%>
- </td>
- </tr>
-
- <tr>
- <td colspan="5" class="table_footer">
- <input class="reset" type="reset" value="Formular zurücksetzen" />
- <input class="submit" type="submit" name="send" value="Bestellung abschliessen" <%=app.getDisabledHtmlFromSession(request, session)%> />
- </td>
- </tr>
- </tbody>
- </table>
- </form>
- </div>
- </div>
-
- <jsp:include page="/static/footer.jsp" flush="false" />
- </body>
-</html>
<div id="menu">
<ul>
<li><a href="<%=request.getContextPath()%>/" 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>