/** 執行查詢動作 */ public ActionForward Query( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { // Toolket.resetCheckboxCookie(response, "FN"); // Toolket.resetCheckboxCookie(response, "FNList"); // Toolket.resetCheckboxCookie(response, "FN_List"); // Toolket.resetCheckboxCookie(response, "FA_List"); Toolket.resetCheckboxCookie(response, "FNList"); HttpSession session = request.getSession(false); CourseManager manager = (CourseManager) getBean("courseManager"); DynaActionForm aForm = (DynaActionForm) form; // UserCredential user = (UserCredential) session.getAttribute("Credential"); String SelKeyWords = aForm.getString("Data_name"); String SelUnit = aForm.getString("FN_Unit"); String Sel_KW = " And (FD.KeyWords Like '%" + SelKeyWords + "%' or FN.Name Like '%" + SelKeyWords + "%') "; String Sel_UT = " And FN.FN_Unit = '" + SelUnit + "' "; if (SelKeyWords.equals("")) { Sel_KW = ""; } if (SelUnit.equals("")) { Sel_UT = ""; } // List<FileName> FNList = null; List FNList = manager.ezGetBy( "Select FD.Oid, C.name Unit, FD.DocNo, FD.MeetingType, FD.MeetingDate, FN.Name FN_Name " + "From File_DataList FD, File_User FU, code5 C, File_Name FN " + "Where FD.FN_Oid = FU.FN_Oid " + " And FD.FN_Oid = FN.Oid " + " And FN.FN_Unit = C.Oid " + " And FD.approve = '97' " + " And FN.FN_Type = '550' " + " And FN.OpenLine = '637'" + " And FD.ShareType = '563'" + Sel_KW + Sel_UT + "Group By FN.Name " + "Order By C.name, FN.Name DESC "); session.setAttribute("FN_List", FNList); session.setAttribute("myOpen", "open"); session.setAttribute("showType", "Query"); return mapping.findForward("File_OutDownload"); }
public ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(false); CourseManager manager = (CourseManager) getBean("courseManager"); session.setAttribute("allSchoolType", manager.getAllSchoolType()); session.setAttribute( "allDept", manager.ezGetBy("SELECT name, idno FROM code5 WHERE category='Dept' ORDER BY idno")); setContentPage(request.getSession(false), "chief/CoanswReview.jsp"); return mapping.findForward("Main"); }
/** 初始資料 */ public ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { // Toolket.resetCheckboxCookie(response, "FN"); Toolket.resetCheckboxCookie(response, "FNList"); // Toolket.resetCheckboxCookie(response, "FN_List"); // Toolket.resetCheckboxCookie(response, "FA_List"); HttpSession session = request.getSession(false); CourseManager manager = (CourseManager) getBean("courseManager"); session.setAttribute( "FN_Unit", manager.ezGetBy( // 排除沒有法規的單位 sequence = 0 "Select Oid, name From code5 Where category='FileUnit' And sequence <> '0' Order By Oid")); // 取得所屬單位選項 /* List FNList = manager.ezGetBy( "Select FD.Oid, C.name Unit, FD.DocNo, FD.MeetingType, FD.MeetingDate, FN.Name FN_Name " + "From File_DataList FD, File_User FU, code5 C, File_Name FN " + "Where FD.FN_Oid = FU.FN_Oid " + " And FD.FN_Oid = FN.Oid " + " And FN.FN_Unit = C.Oid " + " And FD.approve = '97' " + " And FN.FN_Type = '550' " + " And FN.OpenLine = '637'" + " And FD.ShareType = '563'"+ "Group By FN.Name " + "Order By C.name, FN.Name DESC "); session.setAttribute("FN_List", FNList); */ session.setAttribute("myOpen", "close"); return mapping.findForward("File_OutDownload"); }
public ActionForward unspecified( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { HttpSession session = request.getSession(false); // DynaActionForm dForm = (DynaActionForm) form; // ActionMessages error = new ActionMessages(); //建立共用錯誤訊息 // ActionMessages msg = new ActionMessages(); CourseManager manager = (CourseManager) getBean("courseManager"); List list = manager.ezGetBy("SELECT * FROM dept ORDER BY no"); Map map; List depts = new ArrayList(); SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd HH:mm"); String cname; for (int i = 0; i < list.size(); i++) { map = new HashMap(); map.put("no", ((Map) list.get(i)).get("no")); map.put("sname", ((Map) list.get(i)).get("sname")); map.put("fname", ((Map) list.get(i)).get("fname")); map.put("dname", ((Map) list.get(i)).get("dname")); map.put("engname", ((Map) list.get(i)).get("engname")); map.put("Oid", ((Map) list.get(i)).get("Oid")); map.put("school_name", ((Map) list.get(i)).get("school_name")); if (((Map) list.get(i)).get("last_edit_user") != null) { cname = new String(); cname = manager.ezGetString( "SELECT cname FROM empl WHERE idno='" + ((Map) list.get(i)).get("last_edit_user") + "'"); if (cname == null || cname.equals("")) { cname = manager.ezGetString( "SELECT cname FROM dempl WHERE idno='" + ((Map) list.get(i)).get("last_edit_user") + "'"); } map.put("last_edit_user", "*" + cname); } if (((Map) list.get(i)).get("last_edit_time") != null) { map.put( "last_edit_time", sf.format(sf.parse(((Map) list.get(i)).get("last_edit_time").toString()))); } depts.add(map); } session.setAttribute("depts", depts); setContentPage(request.getSession(false), "registration/DeptNameManager.jsp"); return mapping.findForward("Main"); }
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { WebApplicationContext ctx = WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()); HttpSession session = request.getSession(false); CourseManager manager = (CourseManager) ctx.getBean("courseManager"); response.setContentType("application/vnd.ms-excel"); response.setContentType("text/html; charset=utf-8"); response.setHeader("Content-disposition", "attachment;filename=ooxx.xls"); PrintWriter out = response.getWriter(); List dtimeList = (List) session.getAttribute("dtimeList"); // String sterm=manager.getSchoolTerm().toString(); String sterm = session.getAttribute("xterm").toString(); StringBuffer strbuf = new StringBuffer( "SELECT d.techid, e.cname FROM Dtime d, empl e WHERE " + // "d.Sterm='"+sterm+"' AND e.idno=d.techid AND d.Oid IN("); "e.idno=d.techid AND d.Oid IN("); for (int i = 0; i < dtimeList.size(); i++) { strbuf.append("'" + ((Map) dtimeList.get(i)).get("oid") + "',"); } strbuf.delete(strbuf.length() - 1, strbuf.length()); strbuf.append(") GROUP BY d.techid"); List cscodeList = manager.ezGetBy(strbuf.toString()); // String schoolTerm=manager.getSchoolTerm().toString(); // System.out.println(strbuf); for (int i = 0; i < cscodeList.size(); i++) { List myCs = manager.ezGetBy( "SELECT cl.ClassName, c.chi_name FROM " + "((Dtime d LEFT OUTER JOIN Class cl ON d.depart_class=cl.ClassNo)LEFT OUTER JOIN " + "Csno c ON d.cscode=c.cscode) WHERE d.Sterm='" + sterm + "' AND d.techid='" + ((Map) cscodeList.get(i)).get("techid") + "'"); out.println("<table border='1' align='left'>"); out.println("<tr>"); out.println( "<td colspan='2' style='mso-number-format:\\@' nowrap>教師姓名:" + ((Map) cscodeList.get(i)).get("cname") + "</td>"); out.println("</tr>"); int tmp = 0; for (int j = 0; j < myCs.size(); j++) { if (j >= tmp) { tmp = tmp + 2; out.println("<tr>"); } out.println( "<td align='right' style='mso-number-format:\\@' nowrap>" + ((Map) myCs.get(j)).get("ClassName") + "</td>"); out.println( "<td align='left' style='mso-number-format:\\@' nowrap>" + ((Map) myCs.get(j)).get("chi_name") + "</td>"); if (j >= tmp) { out.println("</tr>"); } } out.println("</table>"); out.println("<br>"); } out.close(); }