- Well, this sucks a bit: getAvailableProducts() needs to return something that is Collection and not Iterator (which worked in JSP)
- Added initial index.xhtml and CSS layout for upcoming rewrite (origin: NetBeans)
- updated jcore/jshop
Signed-off-by:Roland Häder <roland@mxchange.org>
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+auxiliary.org-netbeans-modules-html-editor-lib.default-xhtml-public-id=-//W3C//DTD XHTML 1.0 Transitional//EN
auxiliary.org-netbeans-modules-projectapi.jsf_2e_language=Facelets
build.classes.dir=${build.web.dir}/WEB-INF/classes
build.classes.excludes=**/*.java,**/*.form
import java.io.IOException;
import java.sql.SQLException;
+import java.util.Deque;
import java.util.Iterator;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
@Deprecated
static final String HTTP_PARAM_MASK = "%s[%s]"; //NOI18N
+ /**
+ * Some "getter" for a linked list of only available products
+ *
+ * @return Only available products
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Deque<Product> getAvailableProducts () throws ServletException;
+
+ /**
+ * Some "getter" for a linked list of all products
+ *
+ * @return All products
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Deque<Product> getAllProducts () throws ServletException;
+
+ /**
+ * Some "getter" for a linked list of all categories
+ *
+ * @return All categories
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Deque<Category> getAllCategories () throws ServletException;
+
/**
* Initializes this instance with given ServletContext
*
* @return Only available products
* @throws javax.servlet.ServletException If anything went wrong
*/
- public Iterator<Product> getAvailableProducts () throws ServletException;
+ public Iterator<Product> getAvailableProductsIterator () throws ServletException;
/**
* Some "getter" for a an array of all products
* @return All products
* @throws javax.servlet.ServletException If anything went wrong
*/
- public Iterator<Product> getAllProducts () throws ServletException;
+ public Iterator<Product> getAllProductsIterator () throws ServletException;
/**
* Some "getter" for a an array of all categories
* @return All categories
* @throws javax.servlet.ServletException If anything went wrong
*/
- public Iterator<Category> getAllCategories () throws ServletException;
+ public Iterator<Category> getAllCategoriesIterator () throws ServletException;
/**
* Checks if given Product instance is available and returns a printable
import java.lang.reflect.InvocationTargetException;
import java.sql.SQLException;
import java.text.MessageFormat;
+import java.util.Deque;
import java.util.Iterator;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
*/
public class PizzaServiceApplication extends BasePizzaServiceSystem implements PizzaApplication {
/**
- * Frontend for products
+ * Database frontend for products
*/
private ProductFrontend productFrontend;
/**
- * Frontend for categories
+ * Database frontend for categories
*/
private CategoryFrontend categoryFrontend;
this.getLogger().trace("CALLED!"); //NOI18N
}
+ @Override
+ public Deque<Category> getAllCategories () throws ServletException {
+ try {
+ // Deligate to frontend
+ return this.categoryFrontend.getAllCategories();
+ } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ // Continue to throw
+ throw new ServletException(ex);
+ }
+ }
+
+ @Override
+ public Deque<Product> getAllProducts () throws ServletException {
+ try {
+ // Deligate to frontend
+ return this.productFrontend.getAllProducts();
+ } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ // Continue to throw
+ throw new ServletException(ex);
+ }
+ }
+
+ @Override
+ public Deque<Product> getAvailableProducts () throws ServletException {
+ try {
+ // Deligate to frontend
+ return this.productFrontend.getAllAvailableProducts();
+ } catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | IllegalArgumentException | InvocationTargetException ex) {
+ // Continue to throw
+ throw new ServletException(ex);
+ }
+ }
+
@Override
public void init (final ServletContext context) throws UnsupportedDatabaseBackendException, SQLException {
// Trace message
// Init/declare total price and iterator
int totalAmount = 0;
- Iterator<Product> iterator = this.getAvailableProducts();
+ Iterator<Product> iterator = this.getAvailableProductsIterator();
// "Walk" over all products
while (iterator.hasNext()) {
}
@Override
- public Iterator<Product> getAvailableProducts () throws ServletException {
+ @SuppressWarnings ("unchecked")
+ public Iterator<Product> getAvailableProductsIterator () throws ServletException {
// categoryFrontend must be set
if (null == this.productFrontend) {
// Abort here
try {
// Ask frontend for a list of products
- return this.productFrontend.getAvailableProducts();
+ return (Iterator<Product>) this.productFrontend.getAvailableProductsIterator();
} catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
throw new ServletException(ex);
}
}
@Override
- public Iterator<Product> getAllProducts () throws ServletException {
+ @SuppressWarnings ("unchecked")
+ public Iterator<Product> getAllProductsIterator () throws ServletException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
try {
// Ask frontend for a list of products
- return this.productFrontend.getAllProducts();
+ return (Iterator<Product>) this.productFrontend.getAllProductsIterator();
} catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
throw new ServletException(ex);
}
}
@Override
- public Iterator<Category> getAllCategories () throws ServletException {
+ @SuppressWarnings ("unchecked")
+ public Iterator<Category> getAllCategoriesIterator () throws ServletException {
// Trace message
this.getLogger().trace("CALLED!"); //NOI18N
try {
// Ask frontend for a list of categories
- return this.categoryFrontend.getAllCategories();
+ return (Iterator<Category>) this.categoryFrontend.getAllCategoriesIterator();
} catch (final IOException | BadTokenException | SQLException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
throw new ServletException(ex);
}
*/
package org.mxchange.pizzaapplication.beans.controller;
+import java.util.Deque;
import java.util.Iterator;
import javax.faces.FacesException;
import javax.servlet.ServletException;
public void setValueInSession (final HttpSession session, final String key, final Object value);
/**
- * Some "getter" for a an array of only available products
+ * Some "getter" for an iterator of only available products
*
* @return Only available products
* @throws javax.servlet.ServletException If anything went wrong
*/
- public Iterator<Product> getAvailableProducts () throws ServletException;
+ public Iterator<Product> getAvailableProductsIterator () throws ServletException;
/**
- * Some "getter" for a an array of all products
+ * Some "getter" for an iterator of all products
*
* @return All products
* @throws javax.servlet.ServletException If anything went wrong
*/
- public Iterator<Product> getAllProducts () throws ServletException;
+ public Iterator<Product> getAllProductsIterator () throws ServletException;
/**
- * Some "getter" for a an array of all categories
+ * Some "getter" for an iterator of all categories
*
* @return All categories
* @throws javax.servlet.ServletException If anything went wrong
*/
- public Iterator<Category> getAllCategories () throws ServletException;
+ public Iterator<Category> getAllCategoriesIterator () throws ServletException;
+
+ /**
+ * Some "getter" for a linked list of only available products
+ *
+ * @return Only available products
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Deque<Product> getAvailableProducts () throws ServletException;
+
+ /**
+ * Some "getter" for a linked list of all products
+ *
+ * @return All products
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Deque<Product> getAllProducts () throws ServletException;
+
+ /**
+ * Some "getter" for a linked list of all categories
+ *
+ * @return All categories
+ * @throws javax.servlet.ServletException If anything went wrong
+ */
+ public Deque<Category> getAllCategories () throws ServletException;
/**
* Checks if given Product instance is available and returns a printable
import java.io.IOException;
import java.sql.SQLException;
import java.text.MessageFormat;
+import java.util.Deque;
import java.util.Iterator;
import javax.annotation.PostConstruct;
import javax.enterprise.context.SessionScoped;
}
}
- /**
- * Some "getter" for HTML code 'checked="checked"' if the product is choosen
- *
- * @param product Product instance
- * @param request Request instance
- * @param session Session instance
- * @return Whether the product is choosen
- */
@Override
public String getCheckedHtmlFromProduct (final Product product, final ServletRequest request, final HttpSession session) {
return this.app.getCheckedHtmlFromProduct(product, request, session);
}
- /**
- * Some "getter" for HTML code 'disabled="disabled"' for e.g. submit buttons
- *
- * @param request Request instance
- * @param session Session instance
- * @return Whether the product is choosen
- */
@Override
public String getDisabledHtmlFromSession (final ServletRequest request, final HttpSession session) throws ServletException {
return this.app.getDisabledHtmlFromSession(request, session);
}
- /**
- * Checks if given Product instance is available and returns a printable
- * (human-readable) string.
- *
- * @param product Product instance to check
- * @return Human-readable version of product availability
- */
@Override
public String getPrintableProduktAvailability (final Product product) {
return this.app.getPrintableProduktAvailability(product);
}
- /**
- * Some "getter" for a an array of only available products
- *
- * @return All products
- */
@Override
- public Iterator<Product> getAvailableProducts () throws ServletException {
+ public Iterator<Product> getAvailableProductsIterator () throws ServletException {
+ return this.app.getAvailableProductsIterator();
+ }
+
+ @Override
+ public Iterator<Product> getAllProductsIterator () throws ServletException {
+ return this.app.getAllProductsIterator();
+ }
+
+ @Override
+ public Deque<Product> getAvailableProducts () throws ServletException {
return this.app.getAvailableProducts();
}
- /**
- * Some "getter" for a an array of all products
- *
- * @return All products
- */
@Override
- public Iterator<Product> getAllProducts () throws ServletException {
+ public Deque<Product> getAllProducts () throws ServletException {
return this.app.getAllProducts();
}
- /**
- * Some "getter" for a an array of all categories
- *
- * @return All categories
- */
@Override
- public Iterator<Category> getAllCategories () throws ServletException {
+ public Iterator<Category> getAllCategoriesIterator () throws ServletException {
+ return this.app.getAllCategoriesIterator();
+ }
+
+ @Override
+ public Deque<Category> getAllCategories () throws ServletException {
return this.app.getAllCategories();
}
- /**
- * Somewhat setter in session
- *
- * @param session Session instance
- * @param key Session key to set
- * @param value Value to set
- */
@Override
public void setValueInSession (final HttpSession session, final String key, final Object value) {
this.app.setValueInSession(session, key, value);
package org.mxchange.pizzaapplication.filter.servlet.basket;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
import java.text.MessageFormat;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jshop.beans.basket.BasketBean;
import org.mxchange.jshop.item.AddableBasketItem;
import org.mxchange.pizzaapplication.filter.servlet.BaseServletFilter;
// Debug message
this.getLogger().debug(MessageFormat.format("item.id={0},item.itemId={1},item.itemType={2},item.amount={3}", item.getId(), item.getItemId(), item.getItemType(), item.getAmount())); //NOI18N
- try {
- // Cast to servlet request
- HttpServletRequest servletRequest = (HttpServletRequest) request;
+ // Cast to servlet request
+ HttpServletRequest servletRequest = (HttpServletRequest) request;
- // Get session instance
- HttpSession session = servletRequest.getSession();
+ // Get session instance
+ HttpSession session = servletRequest.getSession();
- // Debug message
- this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("session={0}", session)); //NOI18N
- // Should not be null
- if (null == session) {
- // session is null
- throw new NullPointerException("session is null"); //NOI18N
- }
+ // Should not be null
+ if (null == session) {
+ // session is null
+ throw new NullPointerException("session is null"); //NOI18N
+ }
- // Get basket instance
- BasketBean basket = (BasketBean) session.getAttribute("basket"); //NOI18N
+ // Get basket instance
+ BasketBean basket = (BasketBean) session.getAttribute("basket"); //NOI18N
+ // Debug message
+ this.getLogger().debug(MessageFormat.format("basket={0}", basket)); //NOI18N
+
+ // Is the item already added?
+ if (item.getItemId() == null) {
+ // Item id is not set
+ throw new NullPointerException(MessageFormat.format("item id of item={0} is null", item)); //NOI18N
+ } else if (item.getItemType() == null) {
+ // Item type is not set
+ throw new NullPointerException(MessageFormat.format("item type of item={0} is null", item)); //NOI18N
+ } else if ((item.getAmount() == null) || (item.getAmount() == 0)) {
// Debug message
- this.getLogger().debug(MessageFormat.format("basket={0}", basket)); //NOI18N
-
- // Is the item already added?
- if (item.getItemId() == null) {
- // Item id is not set
- throw new NullPointerException(MessageFormat.format("item id of item={0} is null", item)); //NOI18N
- } else if (item.getItemType() == null) {
- // Item type is not set
- throw new NullPointerException(MessageFormat.format("item type of item={0} is null", item)); //NOI18N
- } else if ((item.getAmount() == null) || (item.getAmount() == 0)) {
- // Debug message
- this.getLogger().debug(MessageFormat.format("Amount for item {0} is null - EXIT!", item)); //NOI18N
-
- // 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.getItemId())); //NOI18N
- }
-
- // Register item with it
- basket.addItem(item);
-
- // Is amount null or zero?
- if ((item.getAmount() == null) || (item.getAmount() == 0)) {
- // Then redirect to added=0
- ((HttpServletResponse) response).sendRedirect(servletRequest.getContextPath() + "/?add=0"); //NOI18N
- } else {
- // Redirect to proper URL
- ((HttpServletResponse) response).sendRedirect(servletRequest.getContextPath() + "/?add=1"); //NOI18N
- }
- } catch (final SQLException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
- // Continue to throw
- throw new ServletException(ex);
+ this.getLogger().debug(MessageFormat.format("Amount for item {0} is null - EXIT!", item)); //NOI18N
+
+ // 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.getItemId())); //NOI18N
+ }
+
+ // Register item with it
+ basket.addItem(item);
+
+ // Is amount null or zero?
+ if ((item.getAmount() == null) || (item.getAmount() == 0)) {
+ // Then redirect to added=0
+ ((HttpServletResponse) response).sendRedirect(servletRequest.getContextPath() + "/?add=0"); //NOI18N
+ } else {
+ // Redirect to proper URL
+ ((HttpServletResponse) response).sendRedirect(servletRequest.getContextPath() + "/?add=1"); //NOI18N
}
// Trace message
package org.mxchange.pizzaapplication.tags.basket;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
-import java.sql.SQLException;
import java.text.MessageFormat;
import javax.servlet.ServletException;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.tagext.BodyTagSupport;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import org.mxchange.jcore.exceptions.BadTokenException;
-import org.mxchange.jcore.exceptions.CorruptedDatabaseFileException;
import org.mxchange.jshop.beans.basket.BasketBean;
import org.mxchange.jshop.item.AddableBasketItem;
import org.mxchange.jshop.product.Product;
out.append(" </div>\n"); //NOI18N
out.append("</div>\n"); //NOI18N
}
- } catch (final ServletException | IOException | SQLException | BadTokenException | CorruptedDatabaseFileException | NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
+ } catch (final ServletException ex) {
// Continue to throw
throw new JspException(ex);
}
--- /dev/null
+<?xml version='1.0' encoding='UTF-8'?>
+<faces-config version="2.2"
+ xmlns="http://xmlns.jcp.org/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facesconfig_2_2.xsd">
+
+</faces-config>
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!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"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+
+ <h:head>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
+ <h:outputStylesheet name="./css/default.css"/>
+ <h:outputStylesheet name="./css/cssLayout.css"/>
+ <title>Pizza-Service - <ui:insert name="title">Default title</ui:insert></title>
+ </h:head>
+
+ <h:body>
+ <div id="top">
+ <ui:insert name="top">
+ <div id="header">
+ <div id="title">
+ <h1>Pizza-Service - <ui:insert name="title">Default title</ui:insert></h1>
+ </div>
+ </div>
+ </ui:insert>
+ </div>
+
+ <div id="left_content">
+ <div id="left">
+ <ui:insert name="menu">Default menu</ui:insert>
+ </div>
+
+ <div id="content" class="left_content">
+ <ui:insert name="content_header">Default content header</ui:insert>
+ <ui:insert name="content">Default content</ui:insert>
+ </div>
+
+ <div class="clear"></div>
+ </div>
+
+ <div id="footer">
+ <ui:insert name="footer">Default footer</ui:insert>
+ </div>
+ </h:body>
+</html>
--- /dev/null
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <div class="footer">
+ <ul class="footer_nav">
+ <li><a href="${basePath}/">Home</a></li>
+ <li><a href="${basePath}/imprint.jsp">Impressum</a></li>
+ <li><a href="${basePath}/terms.jsp">AGBs</a></li>
+ <li><a href="${basePath}/privacy.jsp">Datenschutz</a></li>
+ </ul>
+ </div>
+
+ <div class="clear"></div>
+</ui:composition>
--- /dev/null
+<ui:composition
+ xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:f="http://java.sun.com/jsf/core"
+ xmlns:h="http://java.sun.com/jsf/html"
+ xmlns:ui="http://java.sun.com/jsf/facelets">
+ <div class="menu">
+ <ul>
+ <li><a href="${basePath}/" title="Eingangsseite">Home</a></li>
+ <li><a href="${basePath}/basket.jsp" title="Zum Warenkorb">Zum Warenkorb</a></li>
+ <li><a href="${basePath}/bye.jsp" title="Sitzung beennden">Sitzung beenden</a></li>
+ </ul>
+
+ <ul>
+ <li><a href="${basePath}/customer/login.jsp" title="Login für bestehende Kunden">Einloggen</a></li>
+ <li><a href="${basePath}/customer/register.jsp" title="Anmeldung als neuer Kunde">Neuer Kunde</a></li>
+ <li><a href="${basePath}/customer/lost_passwd.jsp" title="Neues Passwort erstellen">Passwort vergessen?</a></li>
+ </ul>
+ </div>
+</ui:composition>
</session-timeout>
</session-config>
<welcome-file-list>
- <!--<welcome-file>faces/index.xhtml</welcome-file>-->
- <welcome-file>index.jsp</welcome-file>
+ <welcome-file>faces/index.xhtml</welcome-file>
+ <!--<welcome-file>index.jsp</welcome-file>-->
</welcome-file-list>
</web-app>
</thead>
<tbody>
- <c:forEach var="category" items="${controller.allCategories}">
+ <c:forEach var="category" items="${controller.allCategoriesIterator}">
<tr>
<td>
${category.categoryId}:
</thead>
<tbody>
- <c:forEach var="product" items="${controller.allProducts}">
+ <c:forEach var="product" items="${controller.allProductsIterator}">
<tr>
<td>
${product.itemId}:
</div>
<div id="content">
+ <!-- TODO: Missing in xhtml: //-->
<basket:mini_basket basket="${basket}" />
<table class="table">
</tbody>
</table>
- <c:forEach var="product" items="${controller.availableProducts}">
+ <c:forEach var="product" items="${controller.availableProductsIterator}">
<c:choose>
<c:when test="${controller.basket.isAdded(product)}">
<c:set var="item" value="${controller.basket.item}" />
--- /dev/null
+<?xml version='1.0' encoding='UTF-8' ?>
+<!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"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+ xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ >
+
+ <f:metadata>
+ <f:viewAction action="#{controller.init()}" />
+ </f:metadata>
+
+ <c:set var="basePath" value="#{request.contextPath}" />
+
+ <!--
+ TODO: Not used:
+ xmlns:basket="http://mxchange.org/jshop/tags/basket"
+ //-->
+
+ <ui:composition template="/WEB-INF/templates/base.tpl">
+ <ui:define name="title">Willkommen!</ui:define>
+
+ <ui:define name="menu">
+ <ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+ </ui:define>
+
+ <ui:define name="content_header">
+ Eingangsseite (dummy)
+ </ui:define>
+
+ <ui:define name="content">
+ <!--
+ TODO Not used!
+ <basket:mini_basket basket="#{basket}" />
+
+ <h:panelGrid class="table" columnClasses="table_data_column" headerClass="table_header_column">
+ <f:facet name="header">
+ Bestellen? Bestellmenge: Produkt: Einzelpreis:
+ </f:facet>
+ </h:panelGrid>
+ //-->
+
+ <table class="table">
+ <thead>
+ <tr>
+ <th colspan="4" class="table_header">
+ Folgendes kann bestellt werden:
+ </th>
+ </tr>
+ </thead>
+
+ <tbody>
+ <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>
+ </tr>
+ </tbody>
+ </table>
+
+ <ui:repeat var="product" value="#{controller.availableProducts}">
+ <c:set var="isAdded" value="#{controller.basket.isAdded(product)}" />
+
+ <ui:fragment rendered="#{isAdded == true}">
+ <table class="table">
+ <tbody>
+ <tr>
+ <td class="table_data_column">
+ <a href="#{basePath}/basket.jsp" title="Zum Warenkorb">Warenkorb</a>
+ </td>
+
+ <td class="table_data_column">
+ #{controller.basket.item.amount}
+ </td>
+
+ <td class="table_data_column">
+ #{product.title}
+ </td>
+
+ <td class="table_data_column" align="right">
+ <h:outputText class="price" value="#{product.price}">
+ <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
+ </h:outputText>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </ui:fragment>
+ <ui:fragment rendered="#{isAdded == false}">
+ <h:form acceptcharset="utf-8" id="add_item">
+ <table class="table">
+ <tbody>
+ <tr>
+ <td class="table_data_column">
+ <h:commandButton class="submit" id="add" value="Hinzufügen" action="#{controller.basket.addToBasket(product)}" />
+ <h:inputHidden id="itemId" value="#{product.itemId}" />
+ <h:inputHidden id="itemType" value="Product" />
+ </td>
+
+ <td class="table_data_column">
+ <h:inputText class="input" id="amount" size="3" maxlength="20" />
+ </td>
+
+ <td class="table_data_column">
+ #{product.title}
+ </td>
+
+ <td class="table_data_column" align="right">
+ <h:outputText class="price" value="#{product.price}">
+ <f:convertNumber type="currency" minFractionDigits="2" maxFractionDigits="2" />
+ </h:outputText>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </h:form>
+ </ui:fragment>
+ </ui:repeat>
+ </ui:define>
+
+ <ui:define name="footer">
+ <ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+ </ui:define>
+ </ui:composition>
+</html>
--- /dev/null
+#top {
+ position: relative;
+ background-color: #036fab;
+ color: white;
+ padding: 5px;
+ margin: 0px 0px 10px 0px;
+}
+
+#footer {
+ position: relative;
+ background-color: #c2dfef;
+ padding: 5px;
+ margin: 10px 0px 0px 0px;
+}
+
+#left {
+ float: left;
+ background-color: #ece3a5;
+ padding: 5px;
+ width: 150px;
+}
+
+#right {
+ float: right;
+ background-color: #ece3a5;
+ padding: 5px;
+ width: 150px;
+}
+
+.center_content {
+ position: relative;
+ background-color: #dddddd;
+ padding: 5px;
+}
+
+.left_content {
+ background-color: #dddddd;
+ padding: 5px;
+ margin-left: 170px;
+}
+
+.right_content {
+ background-color: #dddddd;
+ padding: 5px;
+ margin: 0px 170px 0px 170px;
+}
+
+#top a:link, #top a:visited {
+ color: white;
+ font-weight : bold;
+ text-decoration: none;
+}
+
+#top a:link:hover, #top a:visited:hover {
+ color: black;
+ font-weight : bold;
+ text-decoration : underline;
+}
+
+/**
+div {
+ border: 1px solid #ff0000;
+}
+/**/
+
+table, .table {
+ margin: 0px;
+ padding: 0px;
+}
+
+.table {
+ width: 500px;
+}
+
+.table_row {
+ width: 100%;
+}
+
+.table_left {
+ width: 250px;
+ float: left;
+}
+
+.table_right {
+ width: 200px;
+ float: right;
+}
+
+.table_left25 {
+ width: 20px;
+ float: left;
+}
+
+.table_right75 {
+ width: 430px;
+ float: right;
+}
+
+.para {
+ padding: 5px 5px 5px 5px;
+}
+
+.clear {
+ clear: both;
+}
+
+ul.footer_nav {
+ text-align: center;
+ width : 500px;
+ list-style: none;
+ margin: 0px;
+}
+
+ul.footer_nav li {
+ float: left;
+ width: 100px;
+}
+
+.menu ul {
+ list-style: none;
+ padding-left: 5px;
+}
+
+.table_header {
+ text-align: center;
+ font-weight: bold;
+ font-size: 20px;
+}
+
+.table_header_column {
+ width: 100px;
+}
+
+.table_data_column {
+ width: 100px;
+}
--- /dev/null
+body {
+ background-color: #ffffff;
+ font-size: 12px;
+ font-family: lucida;
+ color: #000000;
+ margin: 10px;
+}
+
+h1 {
+ border-bottom: 1px solid #AFAFAF;
+ font-size: 16px;
+ font-weight: bold;
+ margin: 0px;
+ padding: 0px;
+ color: #D20005;
+}
+
+a:link, a:visited {
+ color: #045491;
+ font-weight : bold;
+ text-decoration: none;
+}
+
+a:link:hover, a:visited:hover {
+ color: #045491;
+ font-weight : bold;
+ text-decoration : underline;
+}
<jsp:useBean id="controller" scope="session" class="org.mxchange.pizzaapplication.beans.controller.PizzaServiceBean" type="PizzaBean" />
<select class="select" name="categoryId" size="1">
- <c:forEach var="category" items="${controller.allCategories}">
+ <c:forEach var="category" items="${controller.allCategoriesIterator}">
<option value="${category.categoryId}">${category.decodedTitle}</option>
</c:forEach>
</select>
<select class="select" name="parentId" size="1">
<option value="">Ist oberste Kategorie</option>
- <c:forEach var="category" items="${controller.allCategories}">
+ <c:forEach var="category" items="${controller.allCategoriesIterator}">
<option value="${category.categoryId}">${category.decodedTitle}</option>
</c:forEach>
</select>