]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
Continued with adding user by administrator:
authorRoland Haeder <roland@mxchange.org>
Tue, 12 Apr 2016 16:58:39 +0000 (18:58 +0200)
committerRoland Haeder <roland@mxchange.org>
Tue, 12 Apr 2016 17:14:07 +0000 (19:14 +0200)
- added addUser() method
- removed creation timestamp as the EJB takes care of it
- renamed errorHandler -> exception as this will become a page for thrown exceptions (later better handling)
- updated jar(s)

lib/jcontacts-core.jar
nbproject/faces-config.NavData
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaAdminUserWebSessionController.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionBean.java
src/java/org/mxchange/pizzaapplication/beans/user/PizzaUserWebSessionController.java
src/java/org/mxchange/pizzaapplication/converter/country/PizzaCountryConverter.java
src/java/org/mxchange/pizzaapplication/converter/smsprovider/PizzaSmsProviderConverter.java
web/WEB-INF/faces-config.xml
web/errorHandler.xhtml [deleted file]
web/exception.xhtml [new file with mode: 0644]

index b94b468717c61b0b3d1b03d19f855d1a15815723..356a84c0658c6bd20121144e4a1e4f16f3c3fec7 100644 (file)
Binary files a/lib/jcontacts-core.jar and b/lib/jcontacts-core.jar differ
index a7dbd6effd274cca8724e226bf92f72db4e53da6..87613f960c64c1c920ae09ea0f4cf5425dfc4731 100644 (file)
@@ -2,38 +2,38 @@
 <Scene Scope="Project" version="2">
     <Scope Scope="Faces Configuration Only"/>
     <Scope Scope="Project">
-        <Node id="customer/checkout2.xhtml" x="400" y="750" zoom="true"/>
-        <Node id="admin/admin_country_list.xhtml" x="1400" y="450" zoom="true"/>
-        <Node id="admin/admin_user_delete.xhtml" x="400" y="300" zoom="true"/>
-        <Node id="privacy.xhtml" x="650" y="450" zoom="true"/>
-        <Node id="customer/checkout.xhtml" x="1150" y="450" zoom="true"/>
-        <Node id="admin/index.xhtml" x="650" y="750" zoom="true"/>
-        <Node id="basket.xhtml" x="1900" y="150" zoom="true"/>
-        <Node id="admin/admin_country_delete.xhtml" x="150" y="600" zoom="true"/>
-        <Node id="admin/admin_country_edit.xhtml" x="150" y="750" zoom="true"/>
-        <Node id="customer/register.xhtml" x="1400" y="300" zoom="true"/>
-        <Node id="item_added.xhtml" x="900" y="450" zoom="true"/>
-        <Node id="admin/admin_user_list.xhtml" x="150" y="300" zoom="true"/>
-        <Node id="terms.xhtml" x="650" y="300" zoom="true"/>
-        <Node id="admin/admin_logout.xhtml" x="400" y="600" zoom="true"/>
-        <Node id="customer/lost_passwd.xhtml" x="150" y="150" zoom="true"/>
-        <Node id="admin/admin_user_add.xhtml" x="900" y="150" zoom="true"/>
-        <Node id="admin/admin_user_edit.xhtml" x="400" y="450" zoom="true"/>
-        <Node id="index.xhtml" x="150" y="900" zoom="true"/>
-        <Node id="errorHandler.xhtml" x="150" y="1050" zoom="true"/>
-        <Node id="logout.xhtml" x="650" y="600" zoom="true"/>
-        <Node id="customer/checkout_done.xhtml" x="1150" y="600" zoom="true"/>
-        <Node id="admin/admin_category_list.xhtml" x="150" y="450" zoom="true"/>
-        <Node id="admin/admin_user_unlock.xhtml" x="1650" y="150" zoom="true"/>
-        <Node id="admin/admin_category_delete.xhtml" x="650" y="150" zoom="true"/>
-        <Node id="customer/login.xhtml" x="1150" y="150" zoom="true"/>
-        <Node id="*" x="1400" y="150" zoom="true"/>
-        <Node id="imprint.xhtml" x="1650" y="300" zoom="true"/>
-        <Node id="admin/admin_product_edit.xhtml" x="400" y="150" zoom="true"/>
-        <Node id="admin/admin_product_delete.xhtml" x="900" y="300" zoom="true"/>
-        <Node id="admin/admin_category_edit.xhtml" x="1150" y="300" zoom="true"/>
-        <Node id="admin/admin_product_list.xhtml" x="400" y="900" zoom="true"/>
-        <Node id="customer/empty_basket.xhtml" x="900" y="600" zoom="true"/>
+        <Node id="customer/checkout2.xhtml" x="1650" y="150" zoom="true"/>
+        <Node id="admin/admin_country_list.xhtml" x="900" y="450" zoom="true"/>
+        <Node id="admin/admin_user_delete.xhtml" x="1150" y="600" zoom="true"/>
+        <Node id="privacy.xhtml" x="1150" y="150" zoom="true"/>
+        <Node id="customer/checkout.xhtml" x="1400" y="150" zoom="true"/>
+        <Node id="admin/index.xhtml" x="150" y="300" zoom="true"/>
+        <Node id="basket.xhtml" x="900" y="600" zoom="true"/>
+        <Node id="exception.xhtml" x="650" y="300" zoom="true"/>
+        <Node id="admin/admin_country_delete.xhtml" x="650" y="150" zoom="true"/>
+        <Node id="customer/register.xhtml" x="396" y="90" zoom="true"/>
+        <Node id="admin/admin_country_edit.xhtml" x="150" y="600" zoom="true"/>
+        <Node id="item_added.xhtml" x="900" y="300" zoom="true"/>
+        <Node id="admin/admin_user_list.xhtml" x="400" y="900" zoom="true"/>
+        <Node id="terms.xhtml" x="400" y="450" zoom="true"/>
+        <Node id="admin/admin_logout.xhtml" x="1150" y="300" zoom="true"/>
+        <Node id="admin/admin_user_edit.xhtml" x="650" y="750" zoom="true"/>
+        <Node id="customer/lost_passwd.xhtml" x="1650" y="300" zoom="true"/>
+        <Node id="admin/admin_user_add.xhtml" x="150" y="150" zoom="true"/>
+        <Node id="index.xhtml" x="900" y="750" zoom="true"/>
+        <Node id="logout.xhtml" x="900" y="150" zoom="true"/>
+        <Node id="customer/checkout_done.xhtml" x="1400" y="450" zoom="true"/>
+        <Node id="admin/admin_user_unlock.xhtml" x="150" y="1050" zoom="true"/>
+        <Node id="admin/admin_category_list.xhtml" x="400" y="600" zoom="true"/>
+        <Node id="admin/admin_category_delete.xhtml" x="150" y="750" zoom="true"/>
+        <Node id="imprint.xhtml" x="650" y="450" zoom="true"/>
+        <Node id="*" x="400" y="750" zoom="true"/>
+        <Node id="customer/login.xhtml" x="1900" y="150" zoom="true"/>
+        <Node id="admin/admin_product_delete.xhtml" x="1400" y="300" zoom="true"/>
+        <Node id="admin/admin_product_edit.xhtml" x="1150" y="450" zoom="true"/>
+        <Node id="admin/admin_category_edit.xhtml" x="400" y="300" zoom="true"/>
+        <Node id="admin/admin_product_list.xhtml" x="650" y="600" zoom="true"/>
+        <Node id="customer/empty_basket.xhtml" x="150" y="900" zoom="true"/>
     </Scope>
     <Scope Scope="All Faces Configurations"/>
 </Scene>
index 37dfe37b008e73178ef5d6503cfded26b90fbcdd..f30ddb5849d9be7d4decbd8a3e5c21055085a1c6 100644 (file)
@@ -24,16 +24,30 @@ import java.util.Objects;
 import javax.annotation.PostConstruct;
 import javax.enterprise.context.SessionScoped;
 import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
 import javax.inject.Named;
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
+import org.mxchange.jcontacts.contact.Contact;
+import org.mxchange.jcontacts.contact.UserContact;
 import org.mxchange.jcontacts.contact.gender.Gender;
 import org.mxchange.jcountry.data.Country;
+import org.mxchange.jphone.phonenumbers.cellphone.CellphoneNumber;
+import org.mxchange.jphone.phonenumbers.cellphone.DialableCellphoneNumber;
+import org.mxchange.jphone.phonenumbers.fax.DialableFaxNumber;
+import org.mxchange.jphone.phonenumbers.fax.FaxNumber;
+import org.mxchange.jphone.phonenumbers.landline.DialableLandLineNumber;
+import org.mxchange.jphone.phonenumbers.landline.LandLineNumber;
 import org.mxchange.jphone.phonenumbers.smsprovider.SmsProvider;
+import org.mxchange.jusercore.exceptions.EmailAddressAlreadyRegisteredException;
+import org.mxchange.jusercore.exceptions.UserNameAlreadyRegisteredException;
 import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.exceptions.UserPasswordMismatchException;
+import org.mxchange.jusercore.model.user.LoginUser;
 import org.mxchange.jusercore.model.user.User;
 import org.mxchange.jusercore.model.user.UserSessionBeanRemote;
+import org.mxchange.jusercore.model.user.UserUtils;
 import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
 
 /**
@@ -181,6 +195,12 @@ public class PizzaAdminUserWebSessionBean implements PizzaAdminUserWebSessionCon
         */
        private Integer zipCode;
 
+       /**
+        * Regular user controller
+        */
+       @Inject
+       private PizzaUserWebSessionController userController;
+
        /**
         * Default constructor
         */
@@ -201,6 +221,128 @@ public class PizzaAdminUserWebSessionBean implements PizzaAdminUserWebSessionCon
                }
        }
 
+       @Override
+       public void addUser () {
+               // Create new user instance
+               User user = new LoginUser();
+               user.setUserName(this.getUserName());
+               user.setUserProfileMode(this.getUserProfileMode());
+
+               // Generate phone number
+               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
+               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
+
+               // Create new contact
+               Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
+               contact.setContactStreet(this.getStreet());
+               contact.setContactHouseNumber(this.getHouseNumber());
+               contact.setContactZipCode(this.getZipCode());
+               contact.setContactCity(this.getCity());
+               contact.setContactCountry(this.getCountry());
+               contact.setContactEmailAddress(this.getEmailAddress());
+
+               // Don't set null or wrong references
+               if ((phone instanceof DialableLandLineNumber) && (phone.getPhoneCountry() instanceof Country) && (this.getPhoneAreaCode() != null) && (this.getPhoneNumber() != null) && (this.getPhoneAreaCode() > 0) && (this.getPhoneNumber() > 0)) {
+                       // Now the number must be given
+                       if (phone.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneAreaCode is null"); //NOI18N
+                       } else if (phone.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (phone.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("phone.phoneNumber is null"); //NOI18N
+                       } else if (phone.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("phone.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set phone number
+                       contact.setContactLandLineNumber(phone);
+               }
+
+               // Don't set null or wrong references
+               if ((fax instanceof DialableFaxNumber) && (fax.getPhoneCountry() instanceof Country) && (this.getFaxAreaCode() != null) && (this.getFaxNumber() != null) && (this.getFaxAreaCode() > 0) && (this.getFaxNumber() > 0)) {
+                       // Now the number must be given
+                       if (fax.getPhoneAreaCode() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneAreaCode is null"); //NOI18N
+                       } else if (fax.getPhoneAreaCode() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneAreaCode is zero or below."); //NOI18N
+                       } else if (fax.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("fax.phoneNumber is null"); //NOI18N
+                       } else if (fax.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("fax.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set fax number
+                       contact.setContactFaxNumber(fax);
+               }
+
+               // Is the provider set?
+               if ((cellphone instanceof DialableCellphoneNumber) && (this.getCellphoneCarrier() instanceof SmsProvider) && (this.getCellphoneNumber() != null) && (this.getCellphoneNumber() > 0)) {
+                       // Is the number set?
+                       if (cellphone.getPhoneNumber() == null) {
+                               // Is null
+                               throw new NullPointerException("cellphone.phoneNumber is null"); //NOI18N
+                       } else if (cellphone.getPhoneNumber() < 1) {
+                               // Abort here
+                               throw new IllegalArgumentException("cellphone.phoneNumber is zero or below."); //NOI18N
+                       }
+
+                       // Set cellphone number
+                       contact.setContactCellphoneNumber(cellphone);
+               }
+
+               contact.setContactBirthday(this.getBirthday());
+               contact.setContactComment(this.getComment());
+
+               // Set contact in user
+               user.setUserContact(contact);
+
+               // Init variable for password
+               String password = null;
+
+               // Is the user name or email address used already?
+               // @TODO Add password length check
+               if (this.userController.isUserNameRegistered(user)) {
+                       // User name is already used
+                       throw new FaceletException(new UserNameAlreadyRegisteredException(user));
+               } else if (this.userController.isEmailAddressRegistered(user)) {
+                       // Email address is already used
+                       throw new FaceletException(new EmailAddressAlreadyRegisteredException(user));
+               } else if ((this.getUserPassword().isEmpty()) && (this.getUserPasswordRepeat().isEmpty())) {
+                       // Empty password entered, then generate one
+                       password = UserUtils.createRandomPassword(PizzaUserWebSessionController.MINIMUM_PASSWORD_LENGTH);
+               } else if (!this.isSamePasswordEntered()) {
+                       // Both passwords don't match
+                       throw new FaceletException(new UserPasswordMismatchException(user));
+               } else {
+                       // Both match, so get it from this bean
+                       password = this.getUserPassword();
+               }
+
+               // The password should not be null and at least 5 characters long
+               assert (password != null) : "password is null";
+               assert (password.length() >= PizzaUserWebSessionController.MINIMUM_PASSWORD_LENGTH) : "Password is not long enough.";
+
+               // Encrypt password and set it
+               user.setUserEncryptedPassword(UserUtils.encryptPassword(password));
+
+               try {
+                       // Now, that all is set, call EJB
+                       this.userBean.addUser(user);
+               } catch (final UserNameAlreadyRegisteredException | EmailAddressAlreadyRegisteredException ex) {
+                       // Throw again
+                       throw new FaceletException(ex);
+               }
+       }
+
        @Override
        public List<User> allUsers () {
                // Return it
@@ -461,6 +603,15 @@ public class PizzaAdminUserWebSessionBean implements PizzaAdminUserWebSessionCon
                this.userList = this.userBean.allUsers();
        }
 
+       /**
+        * Checks if same password is entered and that they are not empty.
+        * <p>
+        * @return Whether the same password was entered
+        */
+       private boolean isSamePasswordEntered () {
+               return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
+       }
+
        @Override
        public User lookupUserById (final Long userId) throws UserNotFoundException {
                // Init variable
index cb34c073092d66780366ce30d3f220345998f377..d24cf739a1f5fd473a7a9cf9c23111fdf5a59bc3 100644 (file)
@@ -59,6 +59,13 @@ public interface PizzaAdminUserWebSessionController extends Serializable {
         */
        boolean hasUsers ();
 
+       /**
+        * Adds user instance to database by preparing a complete user instance and
+        * sending it to the EJB. The data set in the controller is being verified,
+        * e.g. if the user name or email address is not used yet.
+        */
+       void addUser ();
+
        /**
         * Getter for birth day
         * <p>
index 4b99a4d0d5da730a10ebbdafaa3c058e6564686d..fcad6353569c7b16ef22367b64d49807f54e29d3 100644 (file)
@@ -19,7 +19,6 @@ package org.mxchange.pizzaapplication.beans.user;
 import java.text.MessageFormat;
 import java.util.Collections;
 import java.util.Date;
-import java.util.GregorianCalendar;
 import java.util.Iterator;
 import java.util.List;
 import java.util.Objects;
@@ -344,12 +343,11 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                User user = new LoginUser();
                user.setUserName(this.getUserName());
                user.setUserProfileMode(this.getUserProfileMode());
-               user.setUserCreated(new GregorianCalendar());
 
                // Generate phone number
-               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber(), new GregorianCalendar());
-               DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber(), new GregorianCalendar());
-               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber(), new GregorianCalendar());
+               DialableLandLineNumber phone = new LandLineNumber(this.getPhoneCountry(), this.getPhoneAreaCode(), this.getPhoneNumber());
+               DialableCellphoneNumber cellphone = new CellphoneNumber(this.getCellphoneCarrier(), this.getCellphoneNumber());
+               DialableFaxNumber fax = new FaxNumber(this.getFaxCountry(), this.getFaxAreaCode(), this.getFaxNumber());
 
                // Create new contact
                Contact contact = new UserContact(this.getGender(), this.getFirstName(), this.getFamilyName());
@@ -421,7 +419,6 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
                contact.setContactComment(this.getComment());
 
                // Created timestamp and ownContact
-               contact.setContactCreated(new GregorianCalendar());
                contact.setContactOwnContact(Boolean.TRUE);
 
                // Set contact in user
@@ -429,6 +426,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
 
                // Trace message
                //this.getLogger().logTrace(MessageFormat.format("createUserInstance: user={0} - EXIT!", user));
+
                // Return it
                return user;
        }
@@ -730,32 +728,32 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
        }
 
        @Override
-       public boolean isRequiredPersonalDataSet () {
-               return ((this.getUserName() != null) &&
-                               (this.getUserProfileMode() != null) &&
+       public boolean isRequiredChangePersonalDataSet () {
+               return ((this.getUserProfileMode() != null) &&
                                (this.getGender() != null) &&
                                (this.getFirstName() != null) &&
                                (this.getFamilyName() != null) &&
                                (this.getStreet() != null) &&
                                (this.getHouseNumber() != null) &&
                                (this.getZipCode() != null) &&
-                               (this.getCity() != null) &&
-                               (this.getEmailAddress() != null) &&
-                               (this.getEmailAddressRepeat() != null) &&
-                               (this.getUserPassword() != null) &&
-                               (this.getUserPasswordRepeat() != null));
+                               (this.getCity() != null));
        }
 
        @Override
-       public boolean isRequiredChangePersonalDataSet () {
-               return ((this.getUserProfileMode() != null) &&
+       public boolean isRequiredPersonalDataSet () {
+               return ((this.getUserName() != null) &&
+                               (this.getUserProfileMode() != null) &&
                                (this.getGender() != null) &&
                                (this.getFirstName() != null) &&
                                (this.getFamilyName() != null) &&
                                (this.getStreet() != null) &&
                                (this.getHouseNumber() != null) &&
                                (this.getZipCode() != null) &&
-                               (this.getCity() != null));
+                               (this.getCity() != null) &&
+                               (this.getEmailAddress() != null) &&
+                               (this.getEmailAddressRepeat() != null) &&
+                               (this.getUserPassword() != null) &&
+                               (this.getUserPasswordRepeat() != null));
        }
 
        @Override
@@ -765,7 +763,7 @@ public class PizzaUserWebSessionBean implements PizzaUserWebSessionController {
 
        @Override
        public boolean isSamePasswordEntered () {
-               return (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat()));
+               return ((!this.getUserPassword().isEmpty()) && (Objects.equals(this.getUserPassword(), this.getUserPasswordRepeat())));
        }
 
        @Override
index 10d309f3f2b2a2093775bfa4b517ef3044c07934..ec3bbc0693a91fcd8296c0a6d8c3b08ef8dbffee 100644 (file)
@@ -35,6 +35,11 @@ import org.mxchange.jusercore.model.user.profilemodes.ProfileMode;
  */
 public interface PizzaUserWebSessionController extends Serializable {
 
+       /**
+        * Minimum password length
+        */
+       public static final Integer MINIMUM_PASSWORD_LENGTH = 5;
+
        /**
         * Tries to lookup user by given id number. If the user is not found or the
         * account status is not CONFIRMED proper exceptions are thrown.
index 3189fc23535f68fef1d8fefd914871c5828779a8..5b52226984b351948e816aacb3a0715865649ebe 100644 (file)
@@ -136,4 +136,5 @@ public class PizzaCountryConverter implements Converter {
                // Return category id
                return String.valueOf(((Country) value).getCountryId());
        }
+
 }
index ab14e6794597259e3efe92bc29c510fc18724ef6..cfacaaa9e75530c18ce44c2197337dd6d4c41aad 100644 (file)
@@ -136,4 +136,5 @@ public class PizzaSmsProviderConverter implements Converter {
                // Return category id
                return String.valueOf(((SmsProvider) value).getProviderId());
        }
+
 }
index 02ee416aa4b979a173c7726a47f720b2da948561..23b1d5f32578caacccc884e1e8996031d6fcd5d4 100644 (file)
@@ -72,8 +72,8 @@
                        <to-view-id>/basket.xhtml</to-view-id>
                </navigation-case>
                <navigation-case>
-                       <from-outcome>item_not_changed</from-outcome>
-                       <to-view-id>/errorHandler.xhtml</to-view-id>
+                       <from-outcome>exception</from-outcome>
+                       <to-view-id>/exception.xhtml</to-view-id>
                </navigation-case>
                <navigation-case>
                        <from-outcome>admin_delete_user</from-outcome>
                        <to-view-id>/admin/admin_country_edit.xhtml</to-view-id>
                </navigation-case>
        </navigation-rule>
+       <!--
+       <factory>
+               <exception-handler-factory>
+                       org.mxchange.jcoreee.exceptions.CustomExceptionHandlerFactory
+               </exception-handler-factory>
+       </factory>
+       //-->
 </faces-config>
diff --git a/web/errorHandler.xhtml b/web/errorHandler.xhtml
deleted file mode 100644 (file)
index f4970d9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-<%--
-Document   : errorHandler
-Created on : 05.08.2016, 12:06:39
-Author     : Roland Haeder
---%>
-
-<%@page import="java.io.PrintWriter"%>
-<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
-<%@taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
-<jsp:useBean id="date" class="java.util.Date" />
-
-<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
-<c:set var="basePath" value="${pageContext.request.contextPath}" />
-
-<!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="${basePath}/style.css" type="text/css" />
-               <title>Pizza-Service - Fehler</title>
-       </head>
-
-       <body>
-               <div id="header">
-                       <div id="guest_title">
-                               <h1>Pizza-Service - Fehler</h1>
-                       </div>
-               </div>
-
-               <jsp:include page="/WEB-INF/templates/guest/guest_menu.jsp" flush="false" />
-
-               <div id="content_outer">
-                       <div id="content_title">
-                               <h2>An error occurred:</h2>
-                       </div>
-
-                       <div id="content">
-                               Unfortunately an unexpected error has occurred. Below you can find the error details.
-                               <ul>
-                                       <li>Timestamp: <fmt:formatDate value="${date}" type="both" dateStyle="long" timeStyle="long" /></li>
-                                       <li>Action: <c:out value="${requestScope['javax.servlet.forward.request_uri']}" /></li>
-                                       <li>Exception: <c:out value="${requestScope['javax.servlet.error.exception']}" /></li>
-                                       <li>Message: <c:out value="${requestScope['javax.servlet.error.message']}" /></li>
-                                       <li>Status code: <c:out value="${requestScope['javax.servlet.error.status_code']}" /></li>
-                                       <li>User agent: <c:out value="${header['user-agent']}" /></li>
-                               </ul>
-                       </div>
-               </div>
-
-               <jsp:include page="/WEB-INF/templates/guest/guest_footer.jsp" flush="false" />
-       </body>
-</html>
diff --git a/web/exception.xhtml b/web/exception.xhtml
new file mode 100644 (file)
index 0000000..cbb6ce5
--- /dev/null
@@ -0,0 +1,20 @@
+<?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:f="http://xmlns.jcp.org/jsf/core"
+         >
+
+       <ui:composition template="/WEB-INF/templates/guest/guest_base.tpl">
+               <ui:define name="guest_title">#{msg.PAGE_TITLE_EXCEPTION_THROWN}</ui:define>
+
+               <ui:define name="content_header">
+                       #{msg.CONTENT_TITLE_EXCEPTION_THROWN}
+               </ui:define>
+
+               <ui:define name="content">
+                       Unfortunately an unexpected error has occurred.
+               </ui:define>
+       </ui:composition>
+</html>