public String execute() { ExnameDAO exDAO = new ExnameDAO(); Exname ex = exDAO.findById(Integer.valueOf(enid)); List teams = (new TeamsDAO()).findByEnid(ex.getEnid().intValue()); Set set = new HashSet(); String dates[] = date.split("-"); int beYear = Integer.parseInt(dates[0]); int beMonth = Integer.parseInt(dates[1]); int endYear = Integer.parseInt(dates[2]); int endMonth = Integer.parseInt(dates[3]); int begin = beYear * 12 + beMonth; int end = endYear * 12 + endMonth; for (Iterator iterator = teams.iterator(); iterator.hasNext(); ) { Teams t = (Teams) iterator.next(); int nowMon = (t.getDate().getYear() + 1900) * 12 + t.getDate().getMonth(); if (nowMon > begin && nowMon < end && !t.getDatas().isEmpty()) set.add(t); } ActionContext ctx = ActionContext.getContext(); ctx.put("teams", set); ctx.put("date1", date); ctx.put("date2", date); return "success"; }