private ActionForward searchSt( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String path = request.getContextPath(); HashMap mapPara = GetParam.GetParamValue(request, "ISO-8859-1", "utf-8"); String SCORE_GRADE_S = mapPara.get("SCORE_GRADE").toString(); String SCORE_CLASS_S = mapPara.get("SCORE_CLASS").toString(); String STU_NAME_S = mapPara.get("STU_NAME").toString(); String condition = ""; condition += CommonFun.pinCondition("SCORE_GRADE", SCORE_GRADE_S, "", "varchardeng"); condition += CommonFun.pinCondition("SCORE_CLASS", SCORE_CLASS_S, "", "varchardeng"); condition += CommonFun.pinCondition("STU_NAME", STU_NAME_S, "", "varchardeng"); if (!condition.equals("")) { condition = "WHERE " + condition.substring(0, condition.length() - 4); } ScoreManagementDAO dao = new ScoreManagementDAO(); mapPara.put("condition", condition); List stList = dao.searchStList(mapPara); String json = ""; if (stList != null && stList.size() > 0) { json = "["; for (int i = 0; i < stList.size(); i++) { json += "{\"SCORE_NO\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_NO").toString()) + "\","; json += "\"SCORE_GRADE\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_GRADE").toString()) + "\","; json += "\"SCORE_CLASS\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_CLASS").toString()) + "\","; json += "\"STU_SEX\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("STU_SEX").toString()) + "\","; json += "\"STU_NAME\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("STU_NAME").toString()) + "\"},"; } json = json.substring(0, json.length() - 1) + "]"; } else { json = "[]"; } response.getWriter().write(json); response.getWriter().close(); } catch (Exception e) { e.printStackTrace(); } return null; }
private ActionForward searchScore( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String path = request.getContextPath(); HashMap mapPara = GetParam.GetParamValue(request, "ISO-8859-1", "utf-8"); // System.out.println(mapPara); mapPara.put("rp", Integer.parseInt(mapPara.get("rp").toString())); mapPara.put( "page", (Integer.parseInt(mapPara.get("page").toString()) - 1) * Integer.parseInt(mapPara.get("rp").toString())); String condition = ""; String SCORE_YEAR_S = mapPara.get("SCORE_YEAR_S").toString(); String SEMESTER_S = mapPara.get("SEMESTER_S").toString(); String KEMU_S = mapPara.get("KEMU_S").toString(); String SCORE_CLASS_S = mapPara.get("SCORE_CLASS_S").toString(); String STU_NAME_S = mapPara.get("STU_NAME_S").toString(); condition += CommonFun.pinCondition("SCORE_YEAR", SCORE_YEAR_S, "", "varchardeng"); condition += CommonFun.pinCondition("SEMESTER", SEMESTER_S, "", "varchardeng"); condition += CommonFun.pinCondition("KEMU", KEMU_S, "", "varchardeng"); condition += CommonFun.pinCondition("SCORE_CLASS", SCORE_CLASS_S, "", "varchardeng"); condition += CommonFun.pinCondition("STU_NAME", STU_NAME_S, "", "varchar"); if (!condition.equals("")) { condition = "WHERE " + condition.substring(0, condition.length() - 4); } mapPara.put("condition", condition); CommonFun fun = new CommonFun(); ScoreManagementDAO dao = new ScoreManagementDAO(); int total = fun.getTotalItem("SELECT COUNT(*) AS CON FROM score " + condition); String json = ""; int a = Integer.parseInt(mapPara.get("page").toString()) + 1; int b = Integer.parseInt(mapPara.get("rp").toString()); int page = a / b; page = page + 1; List list = dao.searchScoreList(mapPara); if (list != null && list.size() > 0) { json += "{\"page\":" + page + ",\"total\":" + total + ",\"rows\":["; for (int i = 0; i < list.size(); i++) { String ID = exchange.toHtml(((HashMap) list.get(i)).get("ID").toString()); String SCORE_YEAR = exchange.toHtml(((HashMap) list.get(i)).get("SCORE_YEAR").toString()); String SEMESTER = exchange.toHtml(((HashMap) list.get(i)).get("SEMESTER").toString()); String SCORE_GRADE = exchange.toHtml(((HashMap) list.get(i)).get("SCORE_GRADE").toString()); String SCORE_CLASS = exchange.toHtml(((HashMap) list.get(i)).get("SCORE_CLASS").toString()); String SCORE_NO = exchange.toHtml(((HashMap) list.get(i)).get("SCORE_NO").toString()); String STU_NAME = exchange.toHtml(((HashMap) list.get(i)).get("STU_NAME").toString()); String STU_SEX = exchange.toHtml(((HashMap) list.get(i)).get("STU_SEX").toString()); String AAS = exchange.toHtml(((HashMap) list.get(i)).get("AAS").toString()); String KEMU = exchange.toHtml(((HashMap) list.get(i)).get("KEMU").toString()); String CHINESE = exchange.toHtml(((HashMap) list.get(i)).get("CHINESE").toString()); String KEMATCH = exchange.toHtml(((HashMap) list.get(i)).get("KEMATCH").toString()); String ENGLISH = exchange.toHtml(((HashMap) list.get(i)).get("ENGLISH").toString()); String PHYSICAL = exchange.toHtml(((HashMap) list.get(i)).get("PHYSICAL").toString()); String CHEMISTRY = exchange.toHtml(((HashMap) list.get(i)).get("CHEMISTRY").toString()); String BIOLOGICAL = exchange.toHtml(((HashMap) list.get(i)).get("BIOLOGICAL").toString()); String HISTORY = exchange.toHtml(((HashMap) list.get(i)).get("HISTORY").toString()); String POLITY = exchange.toHtml(((HashMap) list.get(i)).get("POLITY").toString()); String GEOGRAPHY = exchange.toHtml(((HashMap) list.get(i)).get("GEOGRAPHY").toString()); String TOTAL_SCORE = exchange.toHtml(((HashMap) list.get(i)).get("TOTAL_SCORE").toString()); json += "{\"id\":\"" + ID + "\","; json += "\"cell\":[\"" + (i + a) + "\",\"" + SCORE_GRADE + "\",\"" + SCORE_CLASS + "\",\"" + SCORE_NO + "\",\"" + STU_NAME + "\",\"" + STU_SEX + "\",\"" + AAS + "\",\"" + KEMU + "\",\"" + CHINESE + "\",\"" + KEMATCH + "\",\"" + ENGLISH + "\",\"" + PHYSICAL + "\",\"" + CHEMISTRY + "\",\"" + BIOLOGICAL + "\",\"" + HISTORY + "\",\"" + POLITY + "\",\"" + GEOGRAPHY + "\",\"" + TOTAL_SCORE + "\"]},"; } json = json.substring(0, json.length() - 1); json += "]}"; } else { json = "[]"; } // System.out.println(json); response.getWriter().write(json); response.getWriter().close(); } catch (Exception e) { e.printStackTrace(); } return null; }
private ActionForward searchStScore( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { try { request.setCharacterEncoding("utf-8"); response.setCharacterEncoding("utf-8"); String path = request.getContextPath(); HashMap mapPara = GetParam.GetParamValue(request, "ISO-8859-1", "utf-8"); ScoreManagementDAO dao = new ScoreManagementDAO(); List stList = dao.searchStScoreList(mapPara); String json = ""; if (stList != null && stList.size() > 0) { json = "["; for (int i = 0; i < stList.size(); i++) { json += "{\"ID\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("ID").toString()) + "\","; json += "\"SCORE_YEAR\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_YEAR").toString()) + "\","; json += "\"SEMESTER\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SEMESTER").toString()) + "\","; json += "\"SCORE_GRADE\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_GRADE").toString()) + "\","; json += "\"SCORE_CLASS\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_CLASS").toString()) + "\","; json += "\"SCORE_NO\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("SCORE_NO").toString()) + "\","; json += "\"STU_NAME\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("STU_NAME").toString()) + "\","; json += "\"STU_SEX\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("STU_SEX").toString()) + "\","; json += "\"AAS\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("AAS").toString()) + "\","; json += "\"KEMU\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("KEMU").toString()) + "\","; json += "\"CHINESE\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("CHINESE").toString()) + "\","; json += "\"KEMATCH\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("KEMATCH").toString()) + "\","; json += "\"ENGLISH\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("ENGLISH").toString()) + "\","; json += "\"PHYSICAL\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("PHYSICAL").toString()) + "\","; json += "\"CHEMISTRY\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("CHEMISTRY").toString()) + "\","; json += "\"BIOLOGICAL\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("BIOLOGICAL").toString()) + "\","; json += "\"HISTORY\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("HISTORY").toString()) + "\","; json += "\"POLITY\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("POLITY").toString()) + "\","; json += "\"GEOGRAPHY\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("GEOGRAPHY").toString()) + "\","; json += "\"TOTAL_SCORE\":\"" + exchange.toHtml(((HashMap) stList.get(i)).get("TOTAL_SCORE").toString()) + "\"},"; } json = json.substring(0, json.length() - 1) + "]"; } else { json = "[]"; } response.getWriter().write(json); response.getWriter().close(); } catch (Exception e) { e.printStackTrace(); } return null; }