public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { String amount = request.getParameter("amount"); String amount2 = request.getParameter("amount2"); String amount3 = request.getParameter("amount3"); Integer posotita = Integer.parseInt(amount); Integer posotita2 = Integer.parseInt(amount2); Integer posotita3 = Integer.parseInt(amount3); HttpSession session = request.getSession(); if (session.isNew()) { request.setAttribute("sessionVal", "this is a new session"); } else { request.setAttribute("sessionVal", "Welcome Back!"); } double total = ((posotita * 18.50) + (posotita2 * 6.95) + (posotita3 * 1.29)); session.setAttribute("totalVal", total); request.setAttribute("currency", total); request.setAttribute("from", amount); request.setAttribute("from2", amount2); request.setAttribute("from3", amount3); RequestDispatcher view = request.getRequestDispatcher("index.jsp"); view.forward(request, response); }
public boolean convalida() { boolean tuttoOk = true; Map<String, String> errori = new HashMap<String, String>(); if ((nome == null) || nome.equals("")) { tuttoOk = false; request.setAttribute("nome", nome); errori.put("nome", "campo obbligatorio"); } if ((descrizione == null) || descrizione.equals("")) { tuttoOk = false; request.setAttribute("descrizione", descrizione); errori.put("descrizione", "campo obbligatorio"); } if ((codice == null) || codice.equals("")) { tuttoOk = false; request.setAttribute("codice", codice); errori.put("codice", "campo obbligatorio"); } if (!isInteger(disponibilita)) { tuttoOk = false; request.setAttribute("disponibilita", disponibilita); errori.put("disponibilita", "formato non valido"); } if (!isInteger(prezzo)) { tuttoOk = false; request.setAttribute("prezzo", prezzo); errori.put("prezzo", "formato non valido"); } if (!tuttoOk) request.setAttribute("errori", errori); HttpSession sess = request.getSession(); sess.setAttribute("errori", errori); return tuttoOk; }
/** * This calls the itemselection.jsp and list all items available for a WorkOrder and a WorkOrder's * item list * * @param workorderid - the WO_ID of the parent WorkOrder * @param request - servlet request * @param response - servlet response */ private void listProducts( long workorderId, WorkOrderDetailRemote workorderdetEJBean, HttpSession session, HttpServletRequest req, HttpServletResponse resp) { try { // If any product object is left over in session remove it session.removeValue("itemObj"); // Create db connection for EJB workorderdetEJBean.connect(); // Get the 2D Array which has the List of Items for the WorkOrder // grouped by the Billing System. Object[][] productList = workorderdetEJBean.getWorkOrderItems(workorderId); // Get the WorkOrder Object WorkOrder workorderObj = workorderdetEJBean.getWorkOrderInfo(workorderId); // Get the List of all Product Names for the WorkOrder String[] productNameList = workorderdetEJBean.getProdList(workorderId); for (int w = 0; w < productNameList.length; w++) USFEnv.getLog() .writeDebug("VALUES INSIDE productNameList is" + productNameList[w], this, null); // Set the attributes to the itemselection JSP req.setAttribute("productNameList", productNameList); req.setAttribute("productList", productList); req.setAttribute("workorderObj", workorderObj); // Release db connection for EJB workorderdetEJBean.release(); // Include the JSP includeJSP(req, resp, ITEM_JSP_PATH, "itemselection"); return; } catch (Exception e) { String errorMsg = "Fail to list products for a WORKORDER " + workorderId; USFEnv.getLog().writeCrit(errorMsg, this, e); errorJSP(req, resp, errorMsg); } }
// Process the request private String processRequest(HttpServletRequest request, HttpServletResponse response) { HttpSession session = request.getSession(); String userIDs = (String) session.getAttribute("user.id"); userIDs = (userIDs != null && userIDs.compareTo(" ") > 0) ? userIDs : "0"; long userID = Long.parseLong(userIDs); String command = request.getParameter("command"); String template = request.getParameter("template"); String pageHash = request.getParameter("pagehash"); String pageTitle = request.getParameter("pagetitle"); String pageDescription = request.getParameter("pagedescription"); String outLine = ""; String nextScript = request.getParameter("nextscript"); OutputStream toClient; boolean success = false; // System.out.println("userid=" + userID + ", id=" + id + ", command=" + command); command = (command != null && command.compareTo(" ") > 0) ? command : "form"; nextScript = (nextScript != null && nextScript.compareTo(" ") > 0) ? nextScript : "simple1.jsp"; // inputstring = (inputstring != null && inputstring.compareTo(" ") > 0) ? inputstring : ""; DbConn myConn = null; try { Context initCtx = new InitialContext(); // String csiSchema = (String) initCtx.lookup("java:comp/env/csi-schema-path"); // String acronym = (String) initCtx.lookup("java:comp/env/SystemAcronym"); myConn = new DbConn(); String csiSchema = myConn.getSchemaPath(); if (userID != 0) { if (command.equals("add")) { outLine = ""; } else if (command.equals("update")) { outLine = ""; } else if (command.equals("updatepage")) { UHash uPage = new UHash(pageHash, myConn); // System.out.println("Got Here 1"); if (template.equals("simple1")) { TextItem title = new TextItem(uPage.get("title"), myConn); title.setText(pageTitle); title.save(myConn); TextItem description = new TextItem(uPage.get("description"), myConn); description.setText(pageDescription); description.save(myConn); } else if (template.equals("simple2")) { } } else if (command.equals("test")) { outLine = "test"; } success = true; } } catch (IllegalArgumentException e) { outLine = outLine + "IllegalArgumentException caught: " + e.getMessage(); ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'"); // log(outLine); } catch (NullPointerException e) { outLine = outLine + "NullPointerException caught: " + e.getMessage(); ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'"); // log(outLine); } // catch (IOException e) { // outLine = outLine + "IOException caught: " + e.getMessage(); // ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'"); // //log(outLine); // } catch (Exception e) { outLine = outLine + "Exception caught: " + e.getMessage(); ALog.logActivity(userID, "csi", 0, pageHash + " error: '" + outLine + "'"); // log(outLine); } finally { try { generateResponse(outLine, command, nextScript, success, response); } catch (Exception i) { } myConn.release(); // log("Test log message\n"); } return outLine; }
// Process the request private String processRequest(HttpServletRequest request, HttpServletResponse response) { String command = request.getParameter("command"); String id = request.getParameter("id"); String description = request.getParameter("description"); String status = request.getParameter("rstatus"); status = (status != null && status.compareTo(" ") > 0) ? status : null; String outLine = ""; // String nextScript = "home.jsp"; String nextScript = request.getParameter("nextscript"); OutputStream toClient; HttpSession session = request.getSession(); boolean success = false; String userIDs = (String) session.getAttribute("user.id"); long userID = Long.parseLong(userIDs); command = (command != null && command.compareTo(" ") > 0) ? command : "form"; nextScript = (nextScript != null && nextScript.compareTo(" ") > 0) ? nextScript : "roles.jsp"; // inputstring = (inputstring != null && inputstring.compareTo(" ") > 0) ? inputstring : ""; DbConn myConn = null; try { Context initCtx = new InitialContext(); // String csiSchema = (String) initCtx.lookup("java:comp/env/csi-schema-path"); String acronym = (String) initCtx.lookup("java:comp/env/SystemAcronym"); myConn = new DbConn(); String csiSchema = myConn.getSchemaPath(); if (command.equals("add")) { Role item = new Role(); item.setDescription(description); item.setStatus(status); getPermissions(request, item); getPositions(request, item); item.add(myConn, userID); GlobalMembership.refresh(myConn); success = true; outLine = ""; } else if (command.equals("update")) { Role item = new Role(myConn, Long.parseLong(id)); item.setDescription(description); item.setStatus(status); getPermissions(request, item); getPositions(request, item); item.save(myConn, userID); GlobalMembership.refresh(myConn); success = true; outLine = ""; } else if (command.equals("drop")) { Role item = new Role(myConn, Long.parseLong(id)); item.drop(myConn, userID); success = true; outLine = "Role " + item.getDescription() + " Removed"; } else if (command.equals("test")) { outLine = "test"; } } catch (IllegalArgumentException e) { outLine = outLine + "IllegalArgumentException caught: " + e.getMessage(); ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'"); // log(outLine); } catch (NullPointerException e) { outLine = outLine + "NullPointerException caught: " + e.getMessage(); ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'"); // log(outLine); } // catch (IOException e) { // outLine = outLine + "IOException caught: " + e.getMessage(); // ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'"); // //log(outLine); // } catch (Exception e) { outLine = outLine + "Exception caught: " + e.getMessage(); ALog.logActivity(userID, "csi", 0, "Role error: '" + outLine + "'"); // log(outLine); } finally { try { generateResponse(outLine, command, nextScript, success, response); } catch (Exception i) { } myConn.release(); // log("Test log message\n"); } return outLine; }
public void service(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { res.setContentType("text/html"); PrintWriter out = res.getWriter(); Connection con = null; String bnm[] = req.getParameterValues("Comics"); String qty[] = new String[bnm.length]; ArrayList al1 = new ArrayList(); ArrayList al2 = new ArrayList(); for (int i = 0; i < bnm.length; i++) { qty[i] = req.getParameter(bnm[i]); al1.add(bnm[i]); al2.add(qty[i]); } HttpSession HSession = req.getSession(true); ArrayList alo1 = (ArrayList) HSession.getValue("bNames"); ArrayList alo2 = (ArrayList) HSession.getValue("bQty"); al1.addAll(alo1); al2.addAll(alo2); HSession.putValue("bNames", al1); HSession.putValue("bQty", al2); out.println("<html>"); out.println("<title>Categories..</title>"); out.println("<body bgcolor=gold >"); out.println("<b><font face=\"Papyrus\" size=36 color= #806F7E><center>"); out.println("<big>Category</big></center>"); out.println("<ul type=disc>"); out.println("<font face=\"Maiandra GD\" color=black size=4>"); out.println("<li type=square>Choose your category.."); out.println("</li></font><br>"); out.println( "<A href=\"FictionClick\"><font face=\"Mistral\" size=8 color=#208234><b>Fiction</b></A><br>"); out.println( "<A href=\"NonFictionClick\"><font face=\"Mistral\" size=8 color=#208234><b>Non-Fiction</b></A><br>"); out.println( "<A href=\"AutobiographyClick\"><font face=\"Mistral\" size=8 color=#208234><b>Autobiography</b></A><br>"); out.println( "<A href=\"HistoryClick\"><font face=\"Mistral\" size=8 color=#208234><b>History</b></A><br>"); out.println( "<A href=\"ComicsClick\"><font face=\"Mistral\" size=8 color=#208234><b>Comics</b></A></font><br><br>"); out.println("<center><form action=\"http://localhost:8080/servlet/FinalList\">"); out.println("<input type=submit value=\" Finalize List >>\"></form>"); out.println("<font face=\"Maiandra GD\" color=black size=4>"); out.println("Moves to final List..</center>"); out.println("</font></body>"); out.println("</html>"); } // service
/** * This is the main controller logic for item selection servlet. This determines whether to show a * list of items for a WorkOrder, add a item, edit a item's detail information, or delete a item. * The product_action parameter is past to this servlet to determine what action to perform. The * product_action parameter is a button defined by JSPs related to product presentation screens. * * <p>The default action is to show all product related to a parent WorkOrder. * * @param req HttpServlet request * @param resp HttpServlet response */ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WorkOrderDetailRemote workorderdetEJBean = null; securityChecks(req, resp); // Get the current session HttpSession session = req.getSession(false); if (session == null) return; String sTmp = ""; // Get a new business logic EJB (custInfoEJBean) USFEnv.getLog().writeDebug("getting buslogic EJB", this, null); try { workorderdetEJBean = workorderdetHome.create(); USFEnv.getLog().writeDebug("EJBean Created", this, null); } catch (CreateException e) { String errorMsg = "Critical Exception in ItemsServlet"; USFEnv.getLog().writeCrit(errorMsg + " failed EJB creation", this, e); errorJSP(req, resp, errorMsg); return; } catch (RemoteException e) { String errorMsg = "Critical Exception in ItemsServlet"; USFEnv.getLog().writeCrit(errorMsg + " failed EJB connect", this, e); errorJSP(req, resp, errorMsg); return; } catch (Exception e) { String errorMsg = "Critical Exception no EJB created"; USFEnv.getLog().writeCrit(errorMsg + " failed EJB creation", this, e); errorJSP(req, resp, errorMsg); return; } try { // Button user pressed in the itemselection.jsp String sJSPAction = req.getParameter("product_action"); USFEnv.getLog().writeWarn("product_action from JSP: " + sJSPAction, this, null); short year = Short.valueOf((String) session.getValue("Iyear")).shortValue(); long customerId = Long.valueOf((String) session.getValue("rcustId")).longValue(); long applicationId = Long.valueOf((String) session.getValue("rappid")).longValue(); long workorderId = 0; long bkId = 0; long billkeyId = 0; long bsId = 0; long wodId = 0; String editflag = ""; String bsNm = ""; java.sql.Date strtDate = null; java.sql.Date endDate = null; String prodError = ""; // Check to make sure session does have an WorkOrder ID if (session.getValue("WorkOrderId") != null) { // If Yes get the parent WorkOrder ID from session workorderId = Long.valueOf((String) session.getValue("WorkOrderId")).longValue(); } // Button Action from JSP is empty then show the Default page of the // Product Listing. if (USFUtil.isBlank(sJSPAction)) { USFEnv.getLog().writeDebug("Display product list for FRN.", this, null); // list items for parent Work Order Number Vector billingsystems = null; WrkOrdrDets workorderdets = new WrkOrdrDets(); billingsystems = workorderdets.getBillingSystems(); req.setAttribute("BillingSystems", billingsystems); for (int s = 0; s < billingsystems.size(); s++) USFEnv.getLog() .writeDebug("INSIDE BILLING SYSTEMS " + billingsystems.elementAt(s), this, null); listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } // Button action from JSP is to Add a new Item else if (sJSPAction.equals("add")) { // Remove the Product Object from session session.removeValue("prodObj"); editflag = "addnew"; req.setAttribute("editflag", editflag); // Read the Item and the Billing System for adding the New // Item. String formProdBsId = (String) req.getParameter("formProdId"); String formProdId = formProdBsId.substring(0, formProdBsId.indexOf("|")); String formProdName = formProdBsId.substring(formProdBsId.indexOf("|") + 1); long rscId = (new Long(formProdId).longValue()); // bsId = (new Long( formBsId ).longValue()) ; String billSystem = formProdName.substring(0, formProdName.indexOf("-")); String itemName = formProdName.substring(formProdName.indexOf("-") + 1); BlgSys blgSys = new BlgSys(); bsId = blgSys.getBsId(billSystem); // Create db connection for EJB workorderdetEJBean.connect(); // Get the WorkOrder Object. WorkOrder woObj = workorderdetEJBean.getWorkOrderInfo(workorderId); // Get the list of Billing Keys for the Billing System. String[] blgKeys = workorderdetEJBean.getBillingKeys(customerId, bsId); // Release db connection for EJB workorderdetEJBean.release(); // If no Billing Keys for the Billing System selected then redirect // to the List Items screen and show the error Message. if (blgKeys == null) { BlgSys blgsys = new BlgSys(); Hashtable bSysList = (Hashtable) blgsys.searchBlgSys(); // Hashtable bSysList = (Hashtable) USFEnv.getBillSystems(); // Set the JSP error message req.setAttribute("errorMsg", "No BTNs for Billing System " + billSystem); // list products for parent WorkOrder Number listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } req.setAttribute("prodcredit", "N"); req.setAttribute("bsystem", String.valueOf(bsId)); req.setAttribute("bkList", blgKeys); req.setAttribute("prodId", formProdId); String wid = String.valueOf(workorderId); session.putValue("workorderId", wid); req.setAttribute("billingsystem", billSystem); req.setAttribute("itemname", itemName); // Include the JSP to Edit Product includeJSP(req, resp, ITEM_JSP_PATH, "editItem"); return; } // Button action from JSP is to Edit a Product else if (sJSPAction.equals("edit")) { String bsysid = req.getParameter("bsId"); session.putValue("bysysidforedit", bsysid); wodId = (new Long((String) req.getParameter("wodId"))).longValue(); // bkId = (new Long( (String) req.getParameter("bkId"))).longValue() ; session.putValue("workorderdetid", String.valueOf(wodId)); bsId = (new Long((String) req.getParameter("bsId"))).longValue(); BlgSys blgSys = new BlgSys(); bsNm = blgSys.getBsName(bsId); // Create db connection for EJB workorderdetEJBean.connect(); // WorkOrder woObj = workorderdetEJBean.getWorkOrderInfo(workorderId); // Get the WorkOrder Number Object WrkOrdrDets wodets_obj = new WrkOrdrDets(); wodets_obj = workorderdetEJBean.getProductInfo(wodId); // Get the List of Billing Keys for the Billing System. String[] blgKeys = workorderdetEJBean.getBillingKeys(customerId, bsId); // Check if the Item has any Credits. If any credits then Billing // Key is not Editable else Editable. if (workorderdetEJBean.hasCredits(wodId)) { req.setAttribute("prodcredit", "Y"); } else { req.setAttribute("prodcredit", "N"); } // Release db connection for EJB workorderdetEJBean.release(); // If Item Object is not null (which generally is the case) then // set the Attributes for the JSP. if (wodets_obj != null) { // Put the Item Object in session editflag = "edit"; session.putValue("wodets", wodets_obj); req.setAttribute("editflag", editflag); // Set the attributes for the Billing System, Billing Key List, req.setAttribute("bkList", blgKeys); req.setAttribute("bsname", bsNm); // Include the JSP to Edit the Item. includeJSP(req, resp, ITEM_JSP_PATH, "editItem"); return; } // If Item Object is null (which generally should not Occur) show // the Default page of Item List for the WorkOrder Number else { // Set the JSP error message req.setAttribute( "errorMsg", "Product Key - " + wodId + " Information not available in the Data Base"); // list items for parent WorkOrder Number listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } } // Button action from JSP is to Delete an Item else if (sJSPAction.equals("delete")) { String formWodId = req.getParameter("wodId"); wodId = (new Long((String) req.getParameter("wodId"))).longValue(); // Create db connection for EJB workorderdetEJBean.connect(); // Delete the Item if (workorderdetEJBean.deleteProduct(wodId)) { req.setAttribute("errorMsg", "Product Key - " + wodId + " Deleted"); } else { req.setAttribute( "errorMsg", "Deletion Failed. Product Key - " + wodId + " is associated with amounts."); } // Release db connection for EJB workorderdetEJBean.release(); // Show the Item List screen listProducts(workorderId, workorderdetEJBean, session, req, resp); return; } // Button action from JSP is to Save a Product. This includes Insertion // of New Product or Updation of an Existing Product. else if (sJSPAction.equals("save")) { boolean save = false; boolean newProd = false; // long qty=0; // Read the Billing System Id String formBsId = (String) req.getParameter("bs_id"); String bsysid = (String) req.getParameter("bsysid"); /* String trans_type = (String) req.getParameter("trans_type"); //String quantity = (String) req.getParameter("qty"); String quantity=""; if (!(req.getParameter("qty").equals(""))) { quantity=(String) req.getParameter("qty"); qty = (new Long(quantity).longValue()); } */ String prod_stat = (String) req.getParameter("prod_stat"); double nrcg_dscnt = (new Double((String) req.getParameter("NonRecurringDiscount"))).doubleValue(); double rcg_dscnt = (new Double((String) req.getParameter("RecurringDiscount"))).doubleValue(); String start_month = (String) req.getParameter("strt_month"); String start_day = (String) req.getParameter("strt_day"); String start_year = (String) req.getParameter("strt_year"); String end_month = (String) req.getParameter("end_month"); String end_day = (String) req.getParameter("end_day"); String end_year = (String) req.getParameter("end_year"); String start_date = start_month + "-" + start_day + "-" + start_year; String end_date = end_month + "-" + end_day + "-" + end_year; long wrkordrid = (new Long((String) session.getValue("WorkOrderId"))).longValue(); String for_editing = req.getParameter("for_editing"); String for_new = req.getParameter("for_new"); String formBkId = (String) req.getParameter("bk_id"); String formBKId = formBkId.substring(0, formBkId.indexOf("|")); String formBTN = formBkId.substring(formBkId.indexOf("|") + 1); billkeyId = (new Long(formBKId)).longValue(); try { bsId = (new Long((String) req.getParameter("bs_id"))).longValue(); } catch (Exception e) { USFEnv.getLog().writeDebug("Exception is " + e, this, null); } RHCCBlgKeys blgkeys = new RHCCBlgKeys(); if (for_editing.equals("editing")) { blgkeys.setRbkId(billkeyId); blgkeys.setRbkKeys(formBTN); blgkeys.setBsId(new Long(bsysid).longValue()); } if (for_new.equals("new")) { blgkeys.setRbkId(billkeyId); blgkeys.setRbkKeys(formBTN); blgkeys.setBsId(bsId); } int index = 0; WrkOrdrDets wod_obj = new WrkOrdrDets(); // wod_obj.setTxTyp(trans_type); // wod_obj.setQty(qty); wod_obj.setNonRcrgDscnt(nrcg_dscnt); wod_obj.setRcrgDscnt(rcg_dscnt); wod_obj.setRBKID(billkeyId); wod_obj.setWodStat(prod_stat); wod_obj.setWOID(wrkordrid); if (!(start_date.equals(""))) { strtDate = new java.sql.Date((new SimpleDateFormat("MM-dd-yyyy")).parse(start_date).getTime()); wod_obj.setStrtDat(strtDate); } // Else if the Start Date is null update the Item Object Date to // null else { wod_obj.setStrtDat(null); } // If Item Service End Date is not null read the date and update // the Item Object with the date if (!(end_date.equals(""))) { endDate = new java.sql.Date((new SimpleDateFormat("MM-dd-yyyy")).parse(end_date).getTime()); wod_obj.setEndDat(endDate); } // Else if the End Date is null update the Item Object Date to null else { wod_obj.setEndDat(null); } // Check if the Start Date is after the End Date or equals End Date if ((strtDate != null) && (endDate != null) && (strtDate.after(endDate))) { prodError = "Product Service Start Date is after Product Service End Date. \n"; index = 1; } else if ((strtDate != null) && (endDate != null) && (strtDate.equals(endDate))) { prodError = "Product Service Start Date equals Product Service End Date. \n"; } workorderdetEJBean.connect(); if (for_editing.equals("editing")) { long workorderdetID = (new Long((String) session.getValue("workorderdetid"))).longValue(); wod_obj.setWODID(workorderdetID); if (index == 0) { save = workorderdetEJBean.saveProduct(wod_obj); } if (save) { prodError = prodError + "<BR> Product Key - " + wod_obj.getWODID() + " Information updated"; req.setAttribute("error", prodError); } else { prodError = prodError + "<BR> Failed to update Product Information"; req.setAttribute("error", prodError); } } if (for_new.equals("new")) { if (index == 0) { int prodId = Integer.parseInt(req.getParameter("prod_Id")); wod_obj.setProd_id(prodId); save = workorderdetEJBean.saveProduct(wod_obj); } if (save) { prodError = prodError + "<BR> Product Key - " + wod_obj.getWODID() + " Information Saved"; req.setAttribute("error", prodError); } else { prodError = prodError + "<BR> Failed to Save Product Information"; req.setAttribute("error", prodError); } } workorderdetEJBean.release(); listProducts(wrkordrid, workorderdetEJBean, session, req, resp); } } // End of try block catch (Exception e) { if (workorderdetEJBean != null) { // calling bean release method try { workorderdetEJBean.release(); } catch (Exception ex) { USFEnv.getLog().writeCrit(" Exception in calling release() method ", this, e); } } String errorMsg = "Processing Exception in Items Servlet: "; USFEnv.getLog().writeCrit(errorMsg, this, e); errorJSP(req, resp, errorMsg); } // End of catch block } // end of doPost()
public void _jspService(HttpServletRequest request, HttpServletResponse response) throws java.io.IOException, ServletException { PageContext pageContext = null; HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; JspWriter _jspx_out = null; PageContext _jspx_page_context = null; try { response.setContentType("text/html; charset=UTF-8"); pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true); _jspx_page_context = pageContext; application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); _jspx_out = out; out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); out.write("\r\n"); String path = request.getContextPath(); String basePath = request.getScheme() + "://" + ("xsaqjy".equals(request.getServerName()) ? "xsaqjy.ljgps.net" : request.getServerName()) + (request.getServerPort() == 80 ? "" : ":" + request.getServerPort()) + path + "/"; Long userno = (Long) session.getAttribute("userno"); // 获得当前登录用户的id用户号 if (userno == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); return; } Long admin = (Long) session.getAttribute("adminflag"); // 获得标记当前登录用户是否为数据管理员 if (admin == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); } Long dwtype = (Long) session.getAttribute("dwtype"); // 获得当前登录用户所在单位类型 0代表交警 1代表货运公司 if (dwtype == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); } String username = (String) request.getSession().getAttribute("username"); if (username == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); } List<String> list = (List<String>) session.getAttribute("list"); // 获得权限的集合 if (list == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); } Long userid = (long) Integer.parseInt((String) request.getSession().getAttribute("driverid")); if (userid == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); return; } Object u = request.getSession().getAttribute("onlineuser"); // 获得当前登录用户的对象 if (u == null) { response.sendRedirect(basePath + "page/admin/login.jsp"); } // 假如获得不到用户,就重新定向到登录页面 session.setAttribute("basePath", basePath); // 把basepath放到session中以便所有的页面使用 out.write("\r\n"); out.write("\r\n"); out.write("<!-- 获取当前日期,时间,星期 -->\r\n"); String week = ""; if (new Date().getDay() == 0) week = "星期日"; if (new Date().getDay() == 1) week = "星期一"; if (new Date().getDay() == 2) week = "星期二"; if (new Date().getDay() == 3) week = "星期三"; if (new Date().getDay() == 4) week = "星期四"; if (new Date().getDay() == 5) week = "星期五"; if (new Date().getDay() == 6) week = "星期六"; java.text.SimpleDateFormat formatter = new java.text.SimpleDateFormat("yyyy/MM/dd HH:mm:ss"); java.util.Date currentTime = new java.util.Date(); // 得到当前系统时间 String date1 = formatter.format(currentTime); // 将日期时间格式化 String date2 = currentTime.toString(); // 将Date型日期时间转换成字符串形式 out.write("\r\n"); out.write( "<!DOCTYPE html PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n"); out.write("<html>\r\n"); out.write("<head>\r\n"); out.write("<base href=\""); out.print(basePath); out.write("\" />\r\n"); out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\">\r\n"); out.write("<title>机动车网上交通安全宣传教育监管平台</title>\r\n"); out.write( "<link href=\"page/admin/css/style.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n"); out.write( "<script type=\"text/javascript\" src=\"page/admin/javascript/jquery.min.js\"></script>\r\n"); out.write("<script type=\"text/javascript\">\r\n"); out.write("\t$(function() {\r\n"); out.write("\t\t//setMenuHeight\r\n"); out.write("\t\t$('.menu').height($(window).height() - 56 - 27 - 26);\r\n"); out.write("\t\t$('.sidebar').height($(window).height() - 56 - 27 - 26);\r\n"); out.write("\t\t$('.page').height($(window).height() - 56 - 27 - 26);\r\n"); out.write("\t\t$('.page iframe').width($(window).width() - 15 - 168);\r\n"); out.write("\t\t$('.subMenu a[href=\"#\"]').next('ul').toggle();\r\n"); out.write("\t\t//menu on and off\r\n"); out.write("\t\t$('.btn').click(function() {\r\n"); out.write("\t\t\t$('.menu').toggle();\r\n"); out.write("\r\n"); out.write("\t\t\tif ($(\".menu\").is(\":hidden\")) {\r\n"); out.write("\t\t\t\t$('iframe').width($(window).width() - 15 + 5);\r\n"); out.write("\t\t\t} else {\r\n"); out.write("\t\t\t\t$('iframe').width($(window).width() - 15 - 168);\r\n"); out.write("\t\t\t}\r\n"); out.write("\t\t});\r\n"); out.write(" \r\n"); out.write("\t\t//\r\n"); out.write("\t\t$('.subMenu a[href=\"#\"]').click(function() {\r\n"); out.write("\t\t\t$(this).next('ul').toggle();\r\n"); out.write("\t\t\treturn false;\r\n"); out.write("\t\t});\r\n"); out.write("\t});\r\n"); out.write("\t\r\n"); out.write("\tfunction clickmenu(topage){\r\n"); out.write("\t\t $('iframe')[0].src = topage;\r\n"); out.write("\t}\r\n"); out.write("</script>\r\n"); out.write("\r\n"); out.write("<!-- 后台页面权限的分配 -->\r\n"); out.write("<script type=\"text/javascript\">\r\n"); out.write("//页面初始化进行\r\n"); out.write("window.onload = function() \r\n"); out.write("{\r\n"); out.write("\tif(\""); out.print(admin); out.write("\" == \"1\")//数据管理员的id号设置为0,当id号为0时,拥有一切权限\r\n"); out.write("\t\t{\r\n"); out.write("\t\t\t$(\"li\").show();\r\n"); out.write("\t\t\t$(\"#otherreprimand\").remove();\r\n"); out.write("\t\t\t$(\"#driverreprimand\").remove();\r\n"); out.write("\t\t\t\r\n"); out.write("\t\t}\r\n"); out.write("\telse\r\n"); out.write("\t\t{\r\n"); out.write("\t\t$(\"li\").hide();\r\n"); out.write("\t\t$(\"#subMenu\").show();\r\n"); out.write("\t\t"); if (dwtype == 0) // 当登录的账号为交警部门时,默认的显示前台页面的8个模块对应的后台数据管理 { out.write("\r\n"); out.write("\t\t $(\"#firstpage\").show();\r\n"); out.write("\t\t\t$(\"#rulenmanage\").show();\r\n"); out.write("\t\t\t$(\"#edunmanage\").show();\r\n"); out.write("\t\t\t$(\"#baseinfo\").show();\r\n"); out.write("\t\t\t$(\"#policeorgmanage\").show();\r\n"); out.write("\t\t\t$(\"#companymanage\").show();\r\n"); out.write("\t\t\t$(\"#carmanage\").show();\r\n"); out.write("\t\t\t$(\"#drivermanage\").show();\r\n"); out.write("\t\t\t$(\"#rulenmanage\").show();\r\n"); out.write("\t\t\t$(\"#branchmanage\").show();\r\n"); out.write("\t\t\t$(\"#safenoticemanage\").show();\r\n"); out.write("\t\t\t$(\"#meetnoticemanage\").show();\r\n"); out.write("\t\t\t$(\"#interchangemanage\").show();\r\n"); out.write("\t\t\t$(\"#micromessagemanage\").show();\r\n"); out.write("\t\t\t$(\"#editpassword\").show();\r\n"); out.write("\t\t\t$(\"#reprimand\").show();\r\n"); out.write("\t\t\t$(\"#carlist\").show();\r\n"); out.write("\t"); } out.write("\r\n"); out.write("\t\r\n"); out.write("\t"); if (dwtype == 1) // 当登录的账号为货运部门时,默认显示货运公司对应的后台数据管理 { out.write("\r\n"); out.write("\t $(\"#firstpage\").show();\r\n"); out.write("\t\t$(\"#baseinfo\").show();\r\n"); out.write("\t\t$(\"#interchangemanage\").show();\r\n"); out.write("\t\t$(\"#editpassword\").show();\r\n"); out.write("\t\t$(\"#safelearn\").show();\r\n"); out.write("\t\t$(\"#otherreprimand\").show();\r\n"); out.write("\t\t$(\"#drivermanage\").show();\r\n"); out.write("\t\t$(\"#micromessagemanage\").show();\r\n"); out.write("\t\t$(\"#carmanage\").show();\r\n"); out.write("\t\t$(\"#companymanage\").show();\r\n"); } out.write("\r\n"); out.write("\r\n"); if (dwtype == 2) // 当登录的账号为货运部门的驾驶员时,默认显示货运公司驾驶员对应的后台数据管理 { out.write("\r\n"); out.write(" $(\"#firstpage\").show();\r\n"); out.write("\t$(\"#baseinfo\").show();\r\n"); out.write("\t$(\"#drivermanage\").show();\r\n"); out.write("\t$(\"#editpassword\").show();\r\n"); out.write("\t$(\"#interchangemanage\").show();\r\n"); out.write("\t$(\"#safelearn\").show();\r\n"); out.write("\t$(\"#micromessagemanage\").show();\r\n"); out.write("\t$(\"#driverreprimand\").show();\r\n"); } out.write("\r\n"); out.write("\t\t"); if (u != null) { String string = ""; for (int i = 0; i < list.size(); i++) { string = list.get(i); out.write("\r\n"); out.write("\t\t$(\"#"); out.print(string); out.write("\").show();\r\n"); out.write("\t\t"); } } out.write("\r\n"); out.write(" }\r\n"); out.write("}\r\n"); out.write("</script>\r\n"); out.write("</head>\r\n"); out.write("<body>\r\n"); out.write( "\t<table border=\"0\" width=\"100%\" height=\"100%\"style=\"margin: 0; padding: 0; background-color: #198bc9\">\r\n"); out.write("\t\t<tr>\r\n"); out.write("\t\t\t<td colspan=\"3\">\r\n"); out.write("\t\t\t\t<div id=\"header\">\r\n"); out.write( "\t\t\t\t<table border=\"0\" width=\"100%\" height=\"100%\" style=\"margin: 0; padding: 0;\">\r\n"); out.write("\t\t\t\t<tr>\r\n"); out.write("\t\t\t\t<td width=\"50%\" style=\"text-align:left\">\r\n"); out.write("\t\t\t\t<div class=\"logo fleft\"> </div>\r\n"); out.write("\t\t\t\t</td>\r\n"); out.write("\t\t\t\t<td width=\"30%\"></td>\r\n"); out.write("\t\t\t\t<td width=\"20%\" style=\"text-align:right\">\r\n"); out.write("\t\t\t\t<div class=\"logoright fleft\" align=\"right\"> </div>\r\n"); out.write("\t\t\t\t</td>\r\n"); out.write("\t\t\t\t</tr>\r\n"); out.write("\t\t\t\t</table>\r\n"); out.write("\t\t\t\t\t</div>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t</tr>\r\n"); out.write("\t\t\r\n"); out.write("\t\t<tr>\r\n"); out.write("\t\t\t<td colspan=\"3\" align=\"left\">\r\n"); out.write("\t\t\t<div class=\"logofont\" style=\"margin-left:25px\">\r\n"); out.write( "\t\t\t<table border=\"0\" width=\"100%\" height=\"100%\" style=\"margin: 0; padding: 0;\">\r\n"); out.write("\t\t\t<tr><td align=\"left\">\r\n"); out.write("\t\t\t<font>用户:"); out.print(username); out.write(" 时间:"); out.print(date1); out.write(" "); out.print(week); out.write(" </font>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t\t<td align=\"right\">\r\n"); out.write( "\t\t\t<a href=\"loginout.action\"><font color=\"#FFFFF0\">退出 </font></a>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t\t</tr>\r\n"); out.write("\t\t\t</table>\r\n"); out.write("\t\t\t</div>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t</tr>\r\n"); out.write("\t\t\r\n"); out.write("\t\t<tr>\r\n"); out.write("\t\t\t<td width=\"168px\">\r\n"); out.write("\t\t\t\t<div class=\"menu fleft\">\r\n"); out.write("\t\t\t\t\t<ul>\r\n"); out.write("\t\t\t\t\t\t<li class=\"subMenuTitle\" id=\"subMenu\">机动车网安教后台管理</li>\r\n"); out.write("\t\t\t\t\t\t<li class=\"subMenu\" id=\"firstpage\">首页设置</li>\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"stationmanage\"><a href=\"#\">参数配置</a>\r\n"); out.write("\t\t\t\t\t\t\t<ul>\r\n"); out.write( "\t\t\t\t\t\t\t\t<li><a href=\"javascript:clickmenu('page/admin/page/config_viewConfigList.action')\">网站信息</a>\r\n"); out.write("\t\t\t\t\t\t\t\t</li>\r\n"); out.write("\t\t\t\t\t\t\t</ul></li>\r\n"); out.write("\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"accountmanage\"><a href=\"#\">系统管理</a>\r\n"); out.write("\t\t\t\t\t\t\t<ul>\r\n"); out.write( "\t\t\t\t\t\t\t\t<li id=\"rolemanage\"><a href=\"javascript:clickmenu('page/admin/page/role_viewRoleList.action')\">角色管理</a></li>\r\n"); out.write( "\t\t\t\t\t\t\t\t<li id=\"accountmanage\"><a href=\"javascript:clickmenu('page/admin/page/account_viewAccountList.action')\">账号管理</a></li>\r\n"); out.write( "\t\t\t\t\t\t\t\t<li id=\"permisionmanage\"><a href=\"javascript:clickmenu('page/admin/page/permission_viewPermissionList.action')\">权限管理</a></li>\r\n"); out.write( "\t\t\t\t\t\t\t\t<li id=\"areamanage\"><a href=\"javascript:clickmenu('page/admin/page/areaback_viewAreaList.action')\">地域管理</a></li>\r\n"); out.write("\t\t\t\t\t\t\t</ul>\r\n"); out.write("\t\t\t\t\t\t</li>\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"rulenmanage\"><a href=\"javascript:clickmenu('page/admin/page/ruleback_viewRuleList.action')\">交通法规</a></li>\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"edunmanage\"><a href=\"javascript:clickmenu('page/admin/page/eduback_viewEduList.action')\">宣教中心</a></li>\r\n"); out.write("\r\n"); out.write("\t\t\t\t\t <li class=\"subMenu\" id=\"baseinfo\"><a href=\"#\">基本信息</a>\r\n"); out.write("\t\t\t\t\t\t <ul>\r\n"); out.write( "\t\t\t\t\t\t <!-- <li id=\"policeorgmanage\"><a href=\"javascript:clickmenu('page/admin/page/orgback_viewPoliceOrgList.action')\">交警部门</a></li> -->\r\n"); out.write( "\t\t\t\t\t\t <li id=\"orgmanage\"><a href=\"javascript:clickmenu('page/admin/page/policeorgback_viewPoliceOrgList.action')\">交警部门</a></li>\r\n"); out.write( "\t\t\t\t\t\t <li class=\"subMenu\" id=\"carlist\"><a href=\"javascript:clickmenu('page/admin/page/policeback_viewPoliceList.action')\">交警信息</a></li>\r\n"); out.write( "\t\t\t\t\t\t\t<li id=\"companymanage\"><a href=\"javascript:clickmenu('page/admin/page/companyback_viewCompanyList.action')\">企业安全组</a></li>\r\n"); out.write( "\t\t\t\t\t\t\t<li id=\"carmanage\"><a href=\"javascript:clickmenu('page/admin/page/carback_viewCarList.action')\">车辆管理</a></li>\r\n"); out.write( "\t\t\t\t\t\t\t<li id=\"drivermanage\"><a href=\"javascript:clickmenu('page/admin/page/driverback_viewDriverList.action')\">驾驶员管理</a></li>\r\n"); out.write( "\t\t\t\t\t\t \t<li class=\"subMenu\" id=\"editpassword\"><a href=\"javascript:clickmenu('page/admin/page/account_viewPassword.action?id="); out.print(userid); out.write("')\">修改密码</a></li>\r\n"); out.write("\t\t\t\t\t\t </ul>\r\n"); out.write("\t\t\t\t\t </li>\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"rulenmanage\"><a href=\"javascript:clickmenu('page/admin/page/illegalback_viewIllegalList.action')\">违法查询</a></li>\r\n"); out.write("\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"branchmanage\"><a href=\"javascript:clickmenu('page/admin/page/branchback_viewBranchList.action')\">快速处理点</a></li>\r\n"); out.write("\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"safenoticemanage\"><a href=\"javascript:clickmenu('page/admin/page/safenoticeback_viewSafeNoticeList.action')\">安全提醒</a></li>\r\n"); out.write("\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"meetnoticemanage\"><a href=\"javascript:clickmenu('page/admin/page/meetnoticeback_viewMeetNoticeList.action')\">会议通知</a></li>\r\n"); out.write("\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"safelearn\"><a href=\"javascript:clickmenu('page/admin/page/safelearnback_viewEduList.action')\">安全教育学习</a></li>\r\n"); out.write("\t\t\t\t\t\t\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"reprimand\"><a href=\"javascript:clickmenu('page/admin/page/reprimandback_viewReprimandList.action')\">通报批评</a></li>\r\n"); out.write("\t\t\t\t\t\r\n"); out.write( "\t\t\t\t\t <li class=\"subMenu\" id=\"otherreprimand\"><a href=\"javascript:clickmenu('page/admin/page/otherreprimandback_viewReprimandList.action')\">通报批评</a></li>\r\n"); out.write("\t\t\t\t\t \r\n"); out.write( "\t\t\t\t\t <li class=\"subMenu\" id=\"driverreprimand\"><a href=\"javascript:clickmenu('page/admin/page/otherreprimandback_showDriverReprimand.action')\">通报批评</a></li>\r\n"); out.write("\t\t\t\t\t \r\n"); out.write( "\t\t\t\t\t <li class=\"subMenu\" id=\"interchangemanage\"><a href=\"javascript:clickmenu('page/admin/page/interchangeback_viewInterchangeList.action')\">问题答疑</a></li>\r\n"); out.write("\r\n"); out.write( "\t\t\t\t\t\t<li class=\"subMenu\" id=\"micromessagemanage\"><a href=\"javascript:clickmenu('page/admin/page/micromessage/micromessagelist.jsp')\">微博互动</a></li>\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t\t</ul>\r\n"); out.write("\t\t\t\t\t\r\n"); out.write("\t\t\t\t</div>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t\t<td width=\"5px\">\r\n"); out.write("\t\t\t\t<div class=\"sidebar fleft\">\r\n"); out.write("\t\t\t\t\t<div class=\"btn\"></div>\r\n"); out.write("\t\t\t\t</div>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t\t<td class=\"page\"><iframe width=\"100%\" scrolling=\"auto\"\r\n"); out.write("\t\t\t\t\theight=\"100%\" FRAMEBORDER=0 style=\"border: medium none;\"\r\n"); out.write( "\t\t\t\t\tsrc=\"/TrafficPolice/page/admin/page/Startpage.jsp\" id=\"rightMain\"\r\n"); out.write("\t\t\t\t\tname=\"right\"></iframe>\r\n"); out.write("\t\t\t</td>\r\n"); out.write("\t\t</tr>\r\n"); out.write("\t\t<tr>\r\n"); out.write("\t\t\t<td colspan=\"3\"><div id=\"footer\"></div></td>\r\n"); out.write("\t\t</tr>\r\n"); out.write("\t</table>\r\n"); out.write("</body>\r\n"); out.write("\r\n"); out.write("</html>"); } catch (Throwable t) { if (!(t instanceof SkipPageException)) { out = _jspx_out; if (out != null && out.getBufferSize() != 0) try { out.clearBuffer(); } catch (java.io.IOException e) { } if (_jspx_page_context != null) _jspx_page_context.handlePageException(t); } } finally { _jspxFactory.releasePageContext(_jspx_page_context); } }