From: Roland Haeder <roland@mxchange.org> Date: Mon, 12 Oct 2015 07:11:18 +0000 (+0200) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=f01ce54991733c8e2276e55d665bafb164f581a9;p=addressbook-war.git Continued: - return unmodifyable list instead of array - use correct property name Signed-off-by:Roland Häder <roland@mxchange.org> --- diff --git a/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java b/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java index 126a0267..b6b171ff 100644 --- a/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java +++ b/src/java/org/mxchange/addressbook/beans/country/CountryWebBean.java @@ -16,6 +16,7 @@ package org.mxchange.addressbook.beans.country; * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ +import java.util.Collections; import java.util.List; import javax.annotation.PostConstruct; import javax.enterprise.context.ApplicationScoped; @@ -69,9 +70,9 @@ public class CountryWebBean implements CountryWebController { } @Override - public Country[] allCountries () { + public List<Country> allCountries () { // Return "cached" version - return (Country[]) this.countryList.toArray(); + return Collections.unmodifiableList(this.countryList); } @PostConstruct diff --git a/src/java/org/mxchange/addressbook/beans/country/CountryWebController.java b/src/java/org/mxchange/addressbook/beans/country/CountryWebController.java index b1a80240..311af3bc 100644 --- a/src/java/org/mxchange/addressbook/beans/country/CountryWebController.java +++ b/src/java/org/mxchange/addressbook/beans/country/CountryWebController.java @@ -17,6 +17,7 @@ package org.mxchange.addressbook.beans.country; * this program. If not, see <http://www.gnu.org/licenses/>. */ import java.io.Serializable; +import java.util.List; import org.mxchange.jcountry.data.Country; /** @@ -31,5 +32,5 @@ public interface CountryWebController extends Serializable { * <p> * @return All countries */ - public Country[] allCountries (); + public List<Country> allCountries (); } diff --git a/web/WEB-INF/templates/generic/form_personal_data.tpl b/web/WEB-INF/templates/generic/form_personal_data.tpl index fd33b314..0d3b3703 100644 --- a/web/WEB-INF/templates/generic/form_personal_data.tpl +++ b/web/WEB-INF/templates/generic/form_personal_data.tpl @@ -114,7 +114,7 @@ <div class="table_right"> <h:selectOneMenu class="select" id="country" value="#{userController.country}"> - <f:selectItems value="#{country.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{msg[c.messageKey]}" /> + <f:selectItems value="#{country.allCountries()}" var="c" itemValue="#{c}" itemLabel="#{msg[c.countryI18nkey]}" /> </h:selectOneMenu> </div>