From: Roland Haeder Date: Fri, 28 Aug 2015 09:34:10 +0000 (+0200) Subject: Continued a bit: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4104d48ae376c1dbae736d28003e114900403390;p=pizzaservice-war.git Continued a bit: - used controller bean - messages formatted and ignored for internationalization Signed-off-by:Roland Häder --- diff --git a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java index d234d668..b077f1cf 100644 --- a/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java +++ b/src/java/org/mxchange/pizzaapplication/beans/PizzaServiceBean.java @@ -18,6 +18,7 @@ package org.mxchange.pizzaapplication.beans; import java.io.IOException; import java.sql.SQLException; +import java.text.MessageFormat; import java.util.Iterator; import javax.annotation.PostConstruct; import javax.enterprise.context.SessionScoped; @@ -47,7 +48,7 @@ import org.mxchange.pizzaapplication.product.Product; * * @author Roland Haeder */ -@Named("service") +@Named("controller") @SessionScoped public class PizzaServiceBean implements PizzaBean { /** @@ -83,7 +84,7 @@ public class PizzaServiceBean implements PizzaBean { { // Get new application instance this.LOG = LogManager.getLogger(this); - this.LOG.debug("INITIALIZER!"); + this.LOG.debug("INITIALIZER!"); //NOI18N this.app = new PizzaServiceApplication(); } @@ -91,19 +92,19 @@ public class PizzaServiceBean implements PizzaBean { * Default constructor */ public PizzaServiceBean () { - this.getLogger().trace("CALLED!"); + this.getLogger().trace("CALLED!"); //NOI18N } @Override @PostConstruct public void init () throws FacesException { // Trace message - this.getLogger().trace("application=" + this.getApplication() + ",basket=" + this.getBasket() + " - CALLED!"); + this.getLogger().trace(MessageFormat.format("application={0},basket={1} - CALLED!", this.getApplication(), this.getBasket())); //NOI18N // Must not be null if (this.getApplication() == null) { // Abort here - throw new NullPointerException("application is null"); + throw new NullPointerException("application is null"); //NOI18N } try { @@ -419,7 +420,7 @@ public class PizzaServiceBean implements PizzaBean { @Override public BasketBean getBasket () { // Trace message - this.getLogger().trace("basket=" + this.basket + " - EXIT!"); + //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("basket={0} - EXIT!", this.basket)); //NOI18N // Return it return this.basket; @@ -431,7 +432,7 @@ public class PizzaServiceBean implements PizzaBean { @Override public void setBasket (final BasketBean basket) { // Trace message - this.getLogger().trace("basket=" + basket + " - CALLED!"); + //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("basket={0} - CALLED!", basket)); //NOI18N // Set it here this.basket = basket; @@ -443,7 +444,7 @@ public class PizzaServiceBean implements PizzaBean { @Override public ServletContext getApplication () { // Trace message - this.getLogger().trace("application=" + this.application + " - EXIT!"); + //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("application={0} - EXIT!", this.application)); //NOI18N // Return it return this.application; @@ -455,7 +456,7 @@ public class PizzaServiceBean implements PizzaBean { @Override public void setApplication (final ServletContext application) { // Trace message - this.getLogger().trace("application=" + application + " - CALLED!"); + //* NOISY-DEBUG: */ this.getLogger().trace(MessageFormat.format("application={0} - CALLED!", application)); //NOI18N // Set it here this.application = application; diff --git a/web/index.jsp b/web/index.jsp index 0a33ffc5..719e5ccb 100644 --- a/web/index.jsp +++ b/web/index.jsp @@ -77,13 +77,13 @@ Product product = iterator.next(); // Debug message - product.getLogger().debug("product.itemId=" + product.getItemId()); + controller.getLogger().debug("product=" + product); // Create an item instance form this product AddableBasketItem item = controller.getBasket().getItem(product); // Debug message - product.getLogger().debug("item=" + item); + controller.getLogger().debug("item=" + item); // Has it been already added to the basket? if (item != null) {