@RequestMapping(value = "/selectCity", method = RequestMethod.GET) public String selectCity(Model model, String proId) { List<City> citys = new ArrayList<City>(); for (Entry<Long, City> entry : com.juzhai.passport.InitData.CITY_MAP.entrySet()) { if (proId.equals(String.valueOf(entry.getValue().getProvinceId()))) { citys.add(entry.getValue()); } } model.addAttribute("citys", citys); return "cms/ajax/citys_list"; }
private void assembleCiteys(Model model) { List<City> citys = new ArrayList<City>(); List<Province> provinces = new ArrayList<Province>(); for (Entry<Long, City> entry : com.juzhai.passport.InitData.CITY_MAP.entrySet()) { citys.add(entry.getValue()); } for (Entry<Long, Province> entry : com.juzhai.passport.InitData.PROVINCE_MAP.entrySet()) { provinces.add(entry.getValue()); } List<Category> categoryList = new ArrayList<Category>(); Set<Long> keys = InitData.CATEGORY_MAP.keySet(); for (Long key : keys) { categoryList.add(InitData.CATEGORY_MAP.get(key)); } model.addAttribute("categoryList", categoryList); model.addAttribute("citys", citys); model.addAttribute("suitAges", SuitAge.values()); model.addAttribute("suitGenders", SuitGender.values()); model.addAttribute("suitStatus", SuitStatus.values()); model.addAttribute("provinces", provinces); }