String query = req.getParameter("query");
String groupName = req.getParameter("group");
GroupManager groupMgr = new GroupManager(locale, session);
Group group = groupMgr.getGroup(groupName);
UserManager userManager = new UserManager(locale,session);
List<User> users = userManager.getUsers(group, query);
// create a JSON result: {size:n, list:[{id:1, name:"name"}, ...]}
StringBuffer json = new StringBuffer();
json.append("{\"size\":")
.append(users.size())