public String map() { Department department = new Department(); department.setName("aaa"); department.setDescription("bbb"); Map<String, Department> map = new HashMap<String, Department>(); map.put("d1", department); ActionContext.getContext().put("map", map); return "list"; }
public String listMap() { List<Map<String, Department>> list = new ArrayList<>(); Department department = new Department(); department.setName("aaa"); department.setDescription("bbb"); Map<String, Department> map = new HashMap<String, Department>(); map.put("d1", department); list.add(map); ActionContext.getContext().put("list", list); return "list"; }
public String mapList() { Map<String, List<Department>> map = new HashMap<>(); Department department = new Department(); department.setName("aaa"); department.setDescription("bbb"); List<Department> departments = new ArrayList<>(); departments.add(department); Department department2 = department = new Department(); department2.setName("ccc"); department2.setDescription("ddd"); departments.add(department); map.put("list", departments); ActionContext.getContext().put("map", map); return "list"; }