]> git.mxchange.org Git - addressbook-war.git/commitdiff
redirect back to "Own address books"
authorRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 18:17:30 +0000 (20:17 +0200)
committerRoland Haeder <roland@mxchange.org>
Mon, 12 Oct 2015 18:17:30 +0000 (20:17 +0200)
src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebBean.java
src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebController.java

index f81b2dbabbf82126c979036b02604e68f2ab768b..bade537e4025fdaada0a531fc7500a43e6ec8326 100644 (file)
@@ -91,17 +91,17 @@ public class AddressbookWebBean implements AddressbookWebController {
        }
 
        @Override
-       public void addAddressbook () {
+       public String addAddressbook () {
                // Is this name already used?
                if (!this.loginController.isUserLoggedIn()) {
                        // Not logged in
                        throw new FaceletException("This method can only be called as logged-in user."); //NOI18N
                } else if (this.getAddressbookName() == null) {
                        // Address book name is null
-                       throw new NullPointerException("addressbookName is null");
+                       throw new NullPointerException("addressbookName is null"); //NOI18N
                } else if (this.getAddressbookName().isEmpty()) {
                        // Address book name is empty
-                       throw new IllegalStateException("addressbookName is empty.");
+                       throw new IllegalStateException("addressbookName is empty."); //NOI18N
                } else if (this.isAddressbookNameUsed(this.getAddressbookName())) {
                        // Already used by this user
                        throw new FaceletException(MessageFormat.format("Address book name {0} already used.", this.getAddressbookName())); //NOI18N
@@ -124,6 +124,9 @@ public class AddressbookWebBean implements AddressbookWebController {
 
                        // Add address book entry to list
                        this.addressbookList.add(updatedAddressbook);
+
+                       // All fine
+                       return "login_own_addressbooks"; //NOI18N
                } catch (final AddressbookNameAlreadyUsedException ex) {
                        // Throw again as cause
                        throw new FaceletException(ex);
index 998938a5048660397aaf62a50a66817ae116d415..4750f545d7004e5d251c788151a2621aa142ce83 100644 (file)
@@ -37,10 +37,13 @@ public interface AddressbookWebController extends Serializable {
        public boolean hasCreatedAddressbooks ();
 
        /**
-        * Creates a new address book with a name. For this method to work it is
-        * vital that the user is logged into his/her account.
+        * Creates a new address book with a name and redirects to proper target.
+        * For this method to work it is vital that the user is logged into his/her
+        * account.
+        * <p>
+        * @return Target to redirect to
         */
-       public void addAddressbook ();
+       public String addAddressbook ();
 
        /**
         * Getter for address book name