@Override protected void execute() throws ServletException, IOException { ClassService classService = new ClassService(); JsonArray jsonArray = new JsonArray(); List list = (List) session.getAttribute("list"); if (list != null) { if (list.size() > 12) { // list = null; // list = new ArrayList(); list.remove(0); } } else { list = new ArrayList(); } list.add(classService.getJson()); session.setAttribute("list", list); for (Object object : list) { jsonArray.add((JsonObject) object); } printJson(jsonArray.toString()); }
public void getclass() { ClassService classService = new ClassService(); printJson(classService.getString()); }