tags:

views:

13

answers:

0

Hi,

i want to show countries in drop down list in jsp page, am using struts 2. i used linked hash map for countries list, please anybody help me how can i do this?. please have a look country.java file posted here. Thanks in advance

import java.util.LinkedHashMap; import java.util.Map;

public class Country {

private static final LinkedHashMap COUNTRIES = new LinkedHashMap(); static{ COUNTRIES.put("USA", "United States"); COUNTRIES.put("GBR", "United Kingdom"); }

/** * This method returns country name for the given country code. * @param countryCode * @return String */ public static String getCountryName(String countryCode){ return COUNTRIES.get(countryCode); }

/** * This method returns list of all COUNTRIES in a Map. In the Map, Key will be 3 char country code and value will be the name of the country. * @return Map */ @SuppressWarnings("unchecked") public static Map getAllCountries(){ return (Map) COUNTRIES.clone(); } }