From d6c8daae4432650f7f1035abc4321bb6d25c7b9a Mon Sep 17 00:00:00 2001 From: Roland Haeder Date: Mon, 12 Oct 2015 20:17:30 +0200 Subject: [PATCH] redirect back to "Own address books" --- .../beans/addressbook/AddressbookWebBean.java | 9 ++++++--- .../beans/addressbook/AddressbookWebController.java | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebBean.java b/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebBean.java index f81b2dba..bade537e 100644 --- a/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebBean.java @@ -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); diff --git a/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebController.java b/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebController.java index 998938a5..4750f545 100644 --- a/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebController.java +++ b/src/java/org/mxchange/addressbook/beans/addressbook/AddressbookWebController.java @@ -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. + *

+ * @return Target to redirect to */ - public void addAddressbook (); + public String addAddressbook (); /** * Getter for address book name -- 2.39.5