Beispiel #1
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);

    try {

      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String finance_cheque_id = request.getParameter("finance_cheque_id");
        String sql = "delete from finance_bill where id='" + finance_cheque_id + "'";
        finance_db.executeUpdate(sql);
        finance_db.commit();
        finance_db.close();

      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Beispiel #2
0
  // getListOfSharesByType -
  private Map<String, String> getListOfSharesByType(
      String type, HttpServletRequest request, HttpServletResponse response) {
    Map<String, String> allShares = new HashMap<String, String>();

    // publishedSources - array of source._ids of published sources
    ArrayList<String> publishedSources = new ArrayList<String>();
    try {
      JSONObject sharesObject = new JSONObject(searchSharesByType(type, request, response));
      JSONObject json_response = sharesObject.getJSONObject("response");

      if (json_response.getString("success").equalsIgnoreCase("true")) {
        if (sharesObject.has("data")) {
          // Iterate over share objects and write to our collection
          JSONArray shares = sharesObject.getJSONArray("data");
          for (int i = 0; i < shares.length(); i++) {
            JSONObject share = shares.getJSONObject(i);
            allShares.put(share.getString("title"), share.getString("_id"));
          }
        }
      }
    } catch (Exception e) {
      System.out.println(e.getMessage());
    }
    return allShares;
  }
Beispiel #3
0
 static {
   try {
   } catch (Exception e) {
     e.printStackTrace();
     throw new RuntimeException(e);
   }
 }
  public int doStartTag() throws JspException {
    try {

      ncrMgr = (NcrMgr) pageContext.getSession().getAttribute("ncrMgr");
      List attributeCodeList = null;
      if (listType.equals("dmgType")) {
        attributeCodeList = (List) ncrMgr.getCurrentNcrMeta().getDmgTypeList();
        currentAttributeCode = (SelectionOption) ncrMgr.getCurrentNcr().getDmgType();
      } else if (listType.equals("solType")) {
        attributeCodeList = (List) ncrMgr.getCurrentNcrMeta().getSolTypeList();
        currentAttributeCode = (SelectionOption) ncrMgr.getCurrentNcr().getSolType();
      } else if (listType.equals("ncrType")) {
        attributeCodeList = (List) ncrMgr.getCurrentNcrMeta().getNcrTypeList();
        currentAttributeCode = (SelectionOption) ncrMgr.getCurrentNcr().getNcrType();
      }
      if (attributeCodeList == null || attributeCodeList.size() == 0) {
        return Tag.SKIP_BODY;
      }
      iterator = attributeCodeList.iterator();

    } catch (Exception e) {

      e.printStackTrace();
    }
    return IterationTag.EVAL_BODY_AGAIN;
  }
Beispiel #5
0
  /** Holds value of propertys navigatorName. */
  public int doStartTag() throws JspException {
    try {
      BomMgr bomMgr = (BomMgr) pageContext.getSession().getAttribute("bomMgr");
      MfgProcess mfgProcess = bomMgr.getCurrentMfgProcess();
      if (mfgProcess == null) {
        return Tag.SKIP_BODY;
      }

      pageContext.setAttribute(
          "processId", mfgProcess.getProcessId() == null ? "" : mfgProcess.getProcessId());
      pageContext.setAttribute("processCode", mfgProcess.getProcessCode());
      pageContext.setAttribute("processName", mfgProcess.getProcessName());
      pageContext.setAttribute("description", mfgProcess.getDescription());

      pageContext.setAttribute(
          "processCodeError",
          mfgProcess.isValid("processCode") ? "" : mfgProcess.getMessage("processCode"));
      pageContext.setAttribute(
          "processNameError",
          mfgProcess.isValid("processName") ? "" : mfgProcess.getMessage("processName"));

      pageContext.setAttribute("error", mfgProcess.hasMessage() ? mfgProcess.getMessage() : "");
      pageContext.setAttribute("isSaved", mfgProcess.isSaved() ? "Y" : "N");
    } catch (Exception e) {
      e.printStackTrace();
    }
    return EVAL_BODY_INCLUDE;
  }
Beispiel #6
0
 public void doInitBody() throws JspException {
   try {
     setAttribute();
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
 public static String loadDriver() {
   String sErr = "";
   try {
     java.sql.DriverManager.registerDriver(
         (java.sql.Driver) (Class.forName(DBDriver).newInstance()));
   } catch (Exception e) {
     sErr = e.toString();
   }
   return (sErr);
 }
Beispiel #8
0
  public int doStartTag() throws JspException {

    try {
      comQuotationMgr = (ComQuotationMgr) pageContext.getSession().getAttribute("comQuotationMgr");
      iterator = comQuotationMgr.getCurrentQuotation().getCustomer().getContactList().iterator();
      if (!iterator.hasNext()) {
        return Tag.SKIP_BODY;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }
    return IterationTag.EVAL_BODY_AGAIN;
  }
Beispiel #9
0
  public int doStartTag() throws JspException {
    try {
      List headChargeList =
          ((ProcessHandleTag) getParent()).getCurrentProcessHandleFor().getHeadChargeList();

      iterator = headChargeList.iterator();

      if (headChargeList.size() == 0) {
        return SKIP_BODY;
      }
    } catch (Exception e) {
      e.printStackTrace();
    }

    return IterationTag.EVAL_BODY_AGAIN;
  }
Beispiel #10
0
  private void setAttribute() {

    try {
      contact = (Contact) iterator.next();

      pageContext.setAttribute(
          "contactId", contact.getContactId() == null ? "" : contact.getContactId());
      pageContext.setAttribute(
          "contactName",
          contact.getContactPersonName() == null ? "" : contact.getContactPersonName());
      pageContext.setAttribute("phone", contact.getPhone() == null ? "" : contact.getPhone());
      pageContext.setAttribute("email", contact.getEmail() == null ? "" : contact.getEmail());

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #11
0
 public int doStartTag() throws JspException {
   try {
     mttMgr = (MttMgr) pageContext.getSession().getAttribute("mttMgr");
     iterator =
         mttMgr
             .getCurrentmaterialTransactionTypeMeta()
             .getMaterialTransactionTypeList()
             .iterator();
     if (mttMgr.getCurrentmaterialTransactionTypeMeta().getMaterialTransactionTypeList().size()
         == 0) {
       return SKIP_BODY;
     }
   } catch (Exception e) {
     e.printStackTrace();
   }
   return IterationTag.EVAL_BODY_AGAIN;
 }
Beispiel #12
0
 public int doAfterBody() throws JspException {
   if (iterator.hasNext()) {
     try {
       setAttribute();
     } catch (Exception e) {
       e.printStackTrace();
     }
     return IterationTag.EVAL_BODY_AGAIN;
   } else {
     try {
       bodyContent.writeOut(bodyContent.getEnclosingWriter());
       return SKIP_BODY;
     } catch (IOException ioe) {
       throw new JspTagException(ioe.getMessage());
     }
   }
 }
  public int doStartTag() throws JspException {
    try {
      purchaseRequisitionMgr =
          (PurchaseRequisitionMgr) pageContext.getSession().getAttribute("purchaseRequisitionMgr");

      iterator = purchaseRequisitionMgr.getCurrentPurchaseRequest().getPrDetailList().iterator();
      if (purchaseRequisitionMgr.getCurrentPurchaseRequest().getPrDetailList().size() == 0) {
        return Tag.SKIP_BODY;
      }
      if (!iterator.hasNext()) {
        return Tag.SKIP_BODY;
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return IterationTag.EVAL_BODY_AGAIN;
  }
  private PollerConfiguration getPollerConfiguration() {
    PollerConfiguration pollconfig = null;

    try {
      PollerConfigFactory.init();
      PollerConfigFactory.reload();
      pollconfig = PollerConfigFactory.getInstance().getConfiguration();
    } catch (MarshalException me) {
      me.printStackTrace();
    } catch (ValidationException ve) {
      ve.printStackTrace();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }

    return pollconfig;
  }
Beispiel #15
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      HttpSession session = request.getSession();
      PrintWriter out = response.getWriter();
      MakePdf mm = new MakePdf();
      excel query = new excel();
      getKeyColumn column = new getKeyColumn();
      mm.setConfigFile("xml/stock/pdf_export.xml");
      String sql = "";
      String tablename = request.getParameter("tablename");
      String condition = "";
      String queue = "";
      if (tablename.equals("stock_balance")) {
        queue = "order by chain_ID";
        condition = "where address_group!=''";
      }
      sql = "select * from " + tablename + " " + condition + " " + queue;
      int a = sql.indexOf("*");
      String sqla = sql.substring(0, a) + "count(*) as A" + sql.substring(a + 1, sql.length());

      mm.make(
          (String) dbSession.getAttribute("unit_db_name"),
          tablename,
          sqla,
          sql,
          "pdf_files/stock_data",
          1500,
          session);
      int fileAmount = mm.fileAmount();
      response.sendRedirect("stock/export/pdf_ok_a.jsp?file_amount=" + fileAmount + "");

    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Beispiel #16
0
 // getListOfAllCommunities
 private Map<String, String> getListOfAllNonPersonalCommunities(
     HttpServletRequest request, HttpServletResponse response) {
   Map<String, String> allCommunities = new HashMap<String, String>();
   try {
     JSONObject communitiesObj = new JSONObject(getAllCommunities(request, response));
     if (communitiesObj.has("data")) {
       JSONArray communities = communitiesObj.getJSONArray("data");
       for (int i = 0; i < communities.length(); i++) {
         JSONObject community = communities.getJSONObject(i);
         if (community.getString("isPersonalCommunity").equalsIgnoreCase("false")
             && community.has("name")) {
           allCommunities.put(community.getString("name"), community.getString("_id"));
         }
       }
     }
   } catch (Exception e) {
     System.out.println(e.getMessage());
   }
   return allCommunities;
 }
  public int doStartTag() throws JspException {

    try {
      gosMemberMgr = (GosMemberMgr) pageContext.getSession().getAttribute("gosMemberMgr");

      if (gosMemberMgr.getMemberCardTypeMeta().getMemberCardTypeList().size() > 0) {
        iterator = gosMemberMgr.getMemberCardTypeMeta().getMemberCardTypeList().iterator();
      } else {
        return Tag.SKIP_BODY;
      }

      if (!iterator.hasNext()) {
        return Tag.SKIP_BODY;
      }

    } catch (Exception e) {
      e.printStackTrace();
    }
    return IterationTag.EVAL_BODY_AGAIN;
  }
  private void setPollerConfiguration(PollerConfiguration pollconfig) {
    try {
      pollconfig.validate();

      BufferedWriter bw =
          new BufferedWriter(
              new FileWriter(
                  WTProperties.getValue("SNMPConfig.directory") + "poller-configuration.xml"));
      pollconfig.marshal(bw);
      bw.flush();
      bw.close();
    } catch (MarshalException me) {
      me.printStackTrace();
    } catch (ValidationException ve) {
      ve.printStackTrace();
    } catch (IOException ioe) {
      ioe.printStackTrace();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #19
0
 private void setAttribute() {
   try {
     this.materialTransactionType = (MaterialTransactionType) iterator.next();
     pageContext.setAttribute(
         "materialId",
         materialTransactionType.getAttributeId() == null
             ? ""
             : materialTransactionType.getAttributeId());
     pageContext.setAttribute("materialCode", materialTransactionType.getAttributeCode());
     pageContext.setAttribute("materialName", materialTransactionType.getAttributeName());
     pageContext.setAttribute("materialDescription", materialTransactionType.getDescription());
     pageContext.setAttribute(
         "materialApprovedFlag",
         materialTransactionType.getApprovedFlag() == null
             ? ""
             : this.materialTransactionType.getApprovedFlag());
     pageContext.setAttribute(
         "isReturn",
         materialTransactionType.getType() == null
             ? ""
             : materialTransactionType.getType().equals("2") ? "Retrun" : "");
     pageContext.setAttribute(
         "isIssue",
         materialTransactionType.getType() == null
             ? ""
             : materialTransactionType.getType().equals("1") ? "Issue" : "");
     pageContext.setAttribute(
         "isTransfer",
         materialTransactionType.getType() == null
             ? ""
             : materialTransactionType.getType().equals("3") ? "Transfer" : "");
     pageContext.setAttribute(
         "isConsume",
         materialTransactionType.getType() == null
             ? ""
             : materialTransactionType.getType().equals("4") ? "Consume" : "");
   } catch (Exception e) {
     e.printStackTrace();
   }
 }
  public int doStartTag() throws JspException {
    try {
      HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
      ModuleContext context = (ModuleContext) request.getSession().getAttribute("context");

      String viewObject = request.getParameter("viewObject");
      viewObject = (viewObject == null || viewObject.equals("")) ? "xava_view" : viewObject;
      View view = (View) context.get(request, viewObject);

      MetaReference metaReference = view.getMetaReference(reference).cloneMetaReference();
      metaReference.setName(reference);
      String prefix = request.getParameter("propertyPrefix");
      prefix = prefix == null ? "" : prefix;
      String application = request.getParameter("application");
      String module = request.getParameter("module");
      String referenceKey = Ids.decorate(application, module, prefix + reference);
      request.setAttribute(referenceKey, metaReference);
      String editorURL =
          "reference.jsp?referenceKey="
              + referenceKey
              + "&onlyEditor=true&frame=false&composite=false&descriptionsList=true";
      String editorPrefix = Module.isPortlet() ? "/WEB-INF/jsp/xava/" : "/xava/";
      try {
        pageContext.include(editorPrefix + editorURL);
      } catch (ServletException ex) {
        Throwable cause = ex.getRootCause() == null ? ex : ex.getRootCause();
        log.error(cause.getMessage(), cause);
        pageContext.include(editorPrefix + "editors/notAvailableEditor.jsp");
      } catch (Exception ex) {
        log.error(ex.getMessage(), ex);
        pageContext.include(editorPrefix + "editors/notAvailableEditor.jsp");
      }
    } catch (Exception ex) {
      log.error(ex.getMessage(), ex);
      throw new JspException(XavaResources.getString("descriptionsList_tag_error", reference));
    }
    return SKIP_BODY;
  }
Beispiel #21
0
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);

    try {
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        int i;
        int intRowCount;
        String sqll =
            "select * from stock_config_public_char where describe1='\u51fa\u5165\u5e93\u7406\u7531'";
        ResultSet rs = stock_db.executeQuery(sqll);
        rs.next();
        rs.last();
        intRowCount = rs.getRow();
        String[] del = new String[intRowCount];
        del = (String[]) dbSession.getAttribute("del");
        if (del != null) {
          for (i = 1; i <= intRowCount; i++) {
            String sql = "delete from stock_config_public_char where id='" + del[i - 1] + "'";
            stock_db.executeUpdate(sql);
          }
        }
        stock_db.commit();
        stock_db.close();
        response.sendRedirect("stock/config/apply_gather_pay/reason.jsp");
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  private void setAttribute() {
    try {
      memberCardType = (MemberCardType) iterator.next();

      pageContext.setAttribute(
          "memberCardTypeId",
          memberCardType.getMemberCardTypeId() == null ? "" : memberCardType.getMemberCardTypeId());
      pageContext.setAttribute("memberCardTypeCode", memberCardType.getMemberCardTypeCode());
      pageContext.setAttribute("memberCardTypeName", memberCardType.getMemberCardTypeName());
      pageContext.setAttribute("isSaved", memberCardType.isSaved() ? "Y" : "N");
      pageContext.setAttribute("note", memberCardType.getNote());
      //            pageContext.setAttribute("memberCardTypeCodeError",
      // memberCardType.isValid("memberCardTypeCode") ? "" :
      // memberCardType.getMessage("memberCardTypeCode"));
      //            pageContext.setAttribute("memberCardTypeNameError",
      // memberCardType.isValid("selectionName") ? "" : memberCardType.getMessage("selectionName"));
      //            pageContext.setAttribute("noteError", memberCardType.isValid("note") ? "" :
      // memberCardType.getMessage("note"));

    } catch (Exception e) {
      e.printStackTrace();
    }
  }
Beispiel #23
0
 // getListOfAllPeople
 private Map<String, String> getListOfAllPeople(
     HttpServletRequest request, HttpServletResponse response) {
   Map<String, String> allPeople = new HashMap<String, String>();
   try {
     JSONObject communityObj = new JSONObject(getSystemCommunity(request, response));
     if (communityObj.has("data")) {
       JSONObject community = new JSONObject(communityObj.getString("data"));
       if (community.has("members")) {
         JSONArray members = community.getJSONArray("members");
         for (int i = 0; i < members.length(); i++) {
           JSONObject member = members.getJSONObject(i);
           if (member.has("displayName")) {
             allPeople.put(member.getString("displayName"), member.getString("_id"));
           } else {
             allPeople.put(member.getString("_id"), member.getString("_id"));
           }
         }
       }
     }
   } catch (Exception e) {
     System.out.println(e.getMessage());
   }
   return allPeople;
 }
Beispiel #24
0
  public int doStartTag() throws JspException {
    try {
      purchaseRequisitionMgr =
          (PurchaseRequisitionMgr) pageContext.getSession().getAttribute("purchaseRequisitionMgr");

      PurchaseRequest purchaseRequest = purchaseRequisitionMgr.getCurrentPurchaseRequest();

      pageContext.setAttribute(
          "prId", purchaseRequest.getPrId() == null ? "" : purchaseRequest.getPrId());
      pageContext.setAttribute(
          "creationDate",
          purchaseRequest.getCreationDate() == null ? "" : purchaseRequest.getCreationDate());
      pageContext.setAttribute(
          "createdBy",
          purchaseRequest.getCreatedBy() == null ? "" : purchaseRequest.getCreatedBy());
      pageContext.setAttribute("isSaved", purchaseRequest.isIsSaved() ? "Y" : "N");
      pageContext.setAttribute("isSend", purchaseRequest.isIsSend() ? "Y" : "N");
      pageContext.setAttribute("isClamant", purchaseRequest.isIsClamant() ? "Y" : "N");
      pageContext.setAttribute("statusString", purchaseRequest.getStatusString());
      pageContext.setAttribute(
          "prStatus", purchaseRequest.getPrStatus() == null ? "" : purchaseRequest.getPrStatus());
      pageContext.setAttribute("modifiedReason", purchaseRequest.getModifiedReason());

      pageContext.setAttribute(
          "modifiedReasonError",
          purchaseRequest.isValid("modifiedReason")
              ? ""
              : purchaseRequest.getMessage("modifiedReason"));
      pageContext.setAttribute(
          "prError", purchaseRequest.hasMessage() ? purchaseRequest.getMessage() : "");

    } catch (Exception e) {
      e.printStackTrace();
    }
    return Tag.EVAL_BODY_INCLUDE;
  }
Beispiel #25
0
  public int doStartTag() throws JspException {
    try {
      PurReportMgr purReportMgr =
          (PurReportMgr) pageContext.getSession().getAttribute("purReportMgr");
      ireportPurchaseOrder = purReportMgr.getCurrentIreport().getIreportPurchaseOrder();
      pageContext.setAttribute(
          "poNo", ireportPurchaseOrder.getPoNo() == null ? "" : ireportPurchaseOrder.getPoNo());
      pageContext.setAttribute(
          "poRefNo",
          ireportPurchaseOrder.getPoRefNo() == null ? "" : ireportPurchaseOrder.getPoRefNo());
      pageContext.setAttribute(
          "creationDate",
          ireportPurchaseOrder.getCreationDate() == null
              ? ""
              : ireportPurchaseOrder.getCreationDate());
      pageContext.setAttribute(
          "createdBy",
          ireportPurchaseOrder.getCreatedBy() == null ? "" : ireportPurchaseOrder.getCreatedBy());
    } catch (Exception e) {
      e.printStackTrace();
    }

    return Tag.EVAL_BODY_INCLUDE;
  }
  public synchronized void service(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();
    PrintWriter out = response.getWriter();
    ServletContext application;
    HttpSession session = request.getSession();
    nseer_db_backup1 finance_db = new nseer_db_backup1(dbApplication);
    ValidataNumber validata = new ValidataNumber();
    try {

      if (finance_db.conn((String) dbSession.getAttribute("unit_db_name"))) {
        String file_id = request.getParameter("file_id");
        String balance_sum = request.getParameter("balance_sum");
        String balance_sum1 = request.getParameter("balance_sum1");
        if (validata.validata(balance_sum) && validata.validata(balance_sum1)) {
          String sql2 = "select id from finance_bill where tag='1' and file_id='" + file_id + "'";
          ResultSet rs2 = finance_db.executeQuery(sql2);
          String sql = "";
          if (rs2.next()) {
            sql =
                "update finance_bill set debit_subtotal='"
                    + balance_sum1
                    + "' where tag='1' and file_id='"
                    + file_id
                    + "'";
          } else {

            sql =
                "insert into finance_bill(debit_subtotal,file_id,tag) values('"
                    + balance_sum1
                    + "','"
                    + file_id
                    + "','1')";
          }
          finance_db.executeUpdate(sql);

          sql2 =
              "select id from finance_voucher where account_period='18' and chain_id='"
                  + file_id
                  + "'";
          rs2 = finance_db.executeQuery(sql2);
          if (rs2.next()) {
            sql =
                "update finance_voucher set debit_subtotal='"
                    + balance_sum
                    + "' where account_period='18' and chain_id='"
                    + file_id
                    + "'";
          } else {

            sql =
                "insert into finance_voucher(debit_subtotal,chain_id,account_period) values('"
                    + balance_sum
                    + "','"
                    + file_id
                    + "','18')";
          }
          finance_db.executeUpdate(sql);

          finance_db.commit();
          finance_db.close();
        } else {
          out.println("1");
        }
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
Beispiel #27
0
  public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
      throws IOException, ServletException {
    HttpSession dbSession = request.getSession();
    JspFactory _jspxFactory = JspFactory.getDefaultFactory();
    PageContext pageContext =
        _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
    ServletContext dbApplication = dbSession.getServletContext();

    try {
      PrintWriter out = response.getWriter();

      nseer_db_backup1 stock_db = new nseer_db_backup1(dbApplication);
      nseer_db_backup1 crm_db = new nseer_db_backup1(dbApplication);
      if (stock_db.conn((String) dbSession.getAttribute("unit_db_name"))
          && crm_db.conn((String) dbSession.getAttribute("unit_db_name"))) {

        FileKind FileKind = new FileKind();
        ValidataNumber validata = new ValidataNumber();
        ValidataRecord vr = new ValidataRecord();

        counter count = new counter(dbApplication);
        ValidataTag vt = new ValidataTag();
        String register_ID = (String) dbSession.getAttribute("human_IDD");
        String config_id = request.getParameter("config_id");
        String pay_ID = request.getParameter("pay_ID");
        String product_amount = request.getParameter("product_amount");
        int num = Integer.parseInt(product_amount);
        String payer_name = request.getParameter("payer_name");
        String payer_ID = request.getParameter("payer_ID");
        String reason = request.getParameter("reason");
        String not_return_tag = request.getParameter("not_return_tag");
        String register = request.getParameter("register");
        String register_time = request.getParameter("register_time");
        String demand_return_time = request.getParameter("demand_return_time");
        String sales_name = request.getParameter("sales_name");
        String sales_ID = request.getParameter("sales_ID");
        String bodyc = new String(request.getParameter("remark").getBytes("UTF-8"), "UTF-8");
        String remark = exchange.toHtml(bodyc);
        String time = "";
        java.util.Date now = new java.util.Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
        time = formatter.format(now);
        String[] product_IDn = request.getParameterValues("product_ID");
        String[] amountn = request.getParameterValues("amount");
        if (num == 0 && product_IDn.length == 1) {
          response.sendRedirect("draft/crm/credit_ok_a.jsp?pay_ID=" + pay_ID);
        } else {
          int p = 0;
          for (int i = 1; i <= num; i++) {
            String tem_amount = "amount" + i;
            String amount = request.getParameter(tem_amount);
            if (amount.equals("")) amount = "0";
            if (!validata.validata(amount)) {
              p++;
            }
          }
          int n = 0;
          String product_ID_group = "";
          for (int j = 1; j < product_IDn.length; j++) {
            product_ID_group += product_IDn[j] + ",";
            if (amountn[j].equals("")) amountn[j] = "0";
            if (!validata.validata(amountn[j])) {
              p++;
            }
          }
          for (int i = 1; i <= num; i++) {
            String tem_product_ID = "product_ID" + i;
            String product_ID = request.getParameter(tem_product_ID);
            if (product_ID_group.indexOf(product_ID) != -1) n++;
          }
          if (vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("9")
              || vt.validata(
                      (String) dbSession.getAttribute("unit_db_name"),
                      "stock_apply_pay",
                      "pay_ID",
                      pay_ID,
                      "check_tag")
                  .equals("5")) {

            if (p == 0) {
              try {
                if (n == 0) {
                  boolean flag = false;
                  List rsList = GetWorkflow.getList(crm_db, "crm_config_workflow", "05");
                  String[] elem = new String[3];
                  if (rsList.size() == 0) {
                    flag = true;
                  }
                  String sqll = "";
                  String[] aaa1 =
                      FileKind.getKind(
                          (String) dbSession.getAttribute("unit_db_name"),
                          "crm_file",
                          "customer_ID",
                          payer_ID);

                  String stock_pay_ID =
                      NseerId.getId("stock/pay", (String) dbSession.getAttribute("unit_db_name"));
                  double demand_amount = 0.0d;
                  double list_price_sum = 0.0d;
                  double cost_price_sum = 0.0d;

                  for (int i = 1; i <= num; i++) {
                    String tem_product_name = "product_name" + i;
                    String tem_product_ID = "product_ID" + i;
                    String tem_available_amount = "available_amount" + i;
                    String tem_amount = "amount" + i;
                    String tem_list_price = "list_price" + i;
                    String tem_cost_price = "cost_price" + i;
                    String tem_type = "type" + i;
                    String tem_amount_unit = "amount_unit" + i;
                    String product_name = request.getParameter(tem_product_name);
                    String product_ID = request.getParameter(tem_product_ID);
                    String available_amount = request.getParameter(tem_available_amount);
                    String amount = request.getParameter(tem_amount);
                    if (amount.equals("")) amount = "0";
                    String list_price2 = request.getParameter(tem_list_price);
                    String cost_price = request.getParameter(tem_cost_price);
                    String type = request.getParameter(tem_type);
                    StringTokenizer tokenTO3 = new StringTokenizer(list_price2, ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    String amount_unit = request.getParameter(tem_amount_unit);
                    double list_price_subtotal =
                        Double.parseDouble(list_price) * Double.parseDouble(amount);
                    list_price_sum += list_price_subtotal;
                    double cost_price_subtotal =
                        Double.parseDouble(cost_price) * Double.parseDouble(amount);
                    cost_price_sum += cost_price_subtotal;
                    demand_amount += Double.parseDouble(amount);
                    String sql1 =
                        "update stock_apply_pay_details set amount='"
                            + amount
                            + "',list_price='"
                            + list_price
                            + "',list_price_subtotal='"
                            + list_price_subtotal
                            + "',cost_price='"
                            + cost_price
                            + "',subtotal='"
                            + cost_price_subtotal
                            + "' where pay_ID='"
                            + pay_ID
                            + "' and details_number='"
                            + i
                            + "'";
                    stock_db.executeUpdate(sql1);
                    if (flag) {
                      if (type.equals("物料") || type.equals("外购商品")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0','"
                                + amount
                                + "')";
                        stock_db.executeUpdate(sql2);
                      } else if (type.equals("商品") || type.equals("部件") || type.equals("委外部件")) {
                        String sql2 =
                            "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                + stock_pay_ID
                                + "','"
                                + i
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + type
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','"
                                + amount
                                + "','0')";
                        stock_db.executeUpdate(sql2);
                      }

                      String sql97 =
                          "select * from crm_salecredit_balance_details where crediter_ID='"
                              + payer_ID
                              + "' and product_ID='"
                              + product_ID
                              + "'";
                      ResultSet rs97 = crm_db.executeQuery(sql97);
                      if (rs97.next()) {
                        double balance_amount =
                            rs97.getDouble("amount") + Double.parseDouble(amount);
                        double balance_cost_price_subtotal =
                            rs97.getDouble("subtotal") + cost_price_subtotal;
                        double balance_list_price_subtotal =
                            rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                        String sql96 =
                            "update crm_salecredit_balance_details set amount='"
                                + balance_amount
                                + "',check_tag='1',subtotal='"
                                + balance_cost_price_subtotal
                                + "',list_price_subtotal='"
                                + balance_list_price_subtotal
                                + "' where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_ID
                                + "'";
                        crm_db.executeUpdate(sql96);
                      } else {
                        String[] aaa =
                            FileKind.getKind(
                                (String) dbSession.getAttribute("unit_db_name"),
                                "design_file",
                                "product_ID",
                                product_ID);
                        String sql95 =
                            "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                + aaa[0]
                                + "','"
                                + aaa[1]
                                + "','"
                                + aaa1[0]
                                + "','"
                                + aaa1[1]
                                + "','"
                                + product_ID
                                + "','"
                                + product_name
                                + "','"
                                + list_price
                                + "','"
                                + list_price_subtotal
                                + "','"
                                + cost_price
                                + "','"
                                + cost_price_subtotal
                                + "','"
                                + amount
                                + "','"
                                + payer_ID
                                + "','"
                                + payer_name
                                + "')";
                        crm_db.executeUpdate(sql95);
                      }
                    }
                  }
                  String[] cost_pricen = request.getParameterValues("cost_price");
                  String[] list_pricen = request.getParameterValues("list_price");
                  String[] product_namen = request.getParameterValues("product_name");
                  String[] product_describen = request.getParameterValues("product_describe");
                  String[] amount_unitn = request.getParameterValues("amount_unit");
                  String[] typen = request.getParameterValues("type");
                  for (int i = 1; i < product_IDn.length; i++) {
                    StringTokenizer tokenTO3 = new StringTokenizer(list_pricen[i], ",");
                    String list_price = "";
                    while (tokenTO3.hasMoreTokens()) {
                      String list_price1 = tokenTO3.nextToken();
                      list_price += list_price1;
                    }
                    if (!amountn[i].equals("") && Double.parseDouble(amountn[i]) != 0) {
                      double list_price_subtotal =
                          Double.parseDouble(list_price) * Double.parseDouble(amountn[i]);
                      list_price_sum += list_price_subtotal;
                      double subtotal =
                          Double.parseDouble(cost_pricen[i]) * Double.parseDouble(amountn[i]);
                      cost_price_sum += subtotal;
                      demand_amount += Double.parseDouble(amountn[i]);
                      num++;
                      String sql1 =
                          "insert into stock_apply_pay_details(payer_chain_ID,payer_chain_name,sales_ID,sales_name,payer_ID,payer_name,payer_type,pay_ID,details_number,product_ID,product_name,product_describe,amount,amount_unit,list_price,list_price_subtotal,cost_price,subtotal,type) values ('"
                              + aaa1[0]
                              + "','"
                              + aaa1[1]
                              + "','"
                              + sales_ID
                              + "','"
                              + sales_name
                              + "','"
                              + payer_ID
                              + "','"
                              + payer_name
                              + "','销售赊货','"
                              + pay_ID
                              + "','"
                              + num
                              + "','"
                              + product_IDn[i]
                              + "','"
                              + product_namen[i]
                              + "','"
                              + product_describen[i]
                              + "','"
                              + amountn[i]
                              + "','"
                              + amount_unitn[i]
                              + "','"
                              + list_price
                              + "','"
                              + list_price_subtotal
                              + "','"
                              + cost_pricen[i]
                              + "','"
                              + subtotal
                              + "','"
                              + typen[i]
                              + "')";
                      stock_db.executeUpdate(sql1);
                      // **********************
                      if (rsList.size() == 0) {
                        if (typen[i].equals("物料") || typen[i].equals("外购商品")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0','"
                                  + amountn[i]
                                  + "')";
                          stock_db.executeUpdate(sql2);
                        } else if (typen[i].equals("商品")
                            || typen[i].equals("部件")
                            || typen[i].equals("委外部件")) {
                          String sql2 =
                              "insert into stock_pay_details(pay_ID,details_number,product_ID,product_name,type,list_price,list_price_subtotal,cost_price,subtotal,amount,unpay_amount,apply_manufacture_amount,apply_purchase_amount) values('"
                                  + stock_pay_ID
                                  + "','"
                                  + num
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + typen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + amountn[i]
                                  + "','0')";
                          stock_db.executeUpdate(sql2);
                        }

                        String sql97 =
                            "select * from crm_salecredit_balance_details where crediter_ID='"
                                + payer_ID
                                + "' and product_ID='"
                                + product_IDn[i]
                                + "'";
                        ResultSet rs97 = crm_db.executeQuery(sql97);
                        if (rs97.next()) {
                          double balance_amount =
                              rs97.getDouble("amount") + Double.parseDouble(amountn[i]);
                          double balance_cost_price_subtotal =
                              rs97.getDouble("subtotal") + subtotal;
                          double balance_list_price_subtotal =
                              rs97.getDouble("list_price_subtotal") + list_price_subtotal;

                          String sql96 =
                              "update crm_salecredit_balance_details set amount='"
                                  + balance_amount
                                  + "',check_tag='1',subtotal='"
                                  + balance_cost_price_subtotal
                                  + "',list_price_subtotal='"
                                  + balance_list_price_subtotal
                                  + "' where crediter_ID='"
                                  + payer_ID
                                  + "' and product_ID='"
                                  + product_IDn[i]
                                  + "'";
                          crm_db.executeUpdate(sql96);
                        } else {
                          String[] aaa =
                              FileKind.getKind(
                                  (String) dbSession.getAttribute("unit_db_name"),
                                  "design_file",
                                  "product_ID",
                                  product_IDn[i]);
                          String sql95 =
                              "insert into crm_salecredit_balance_details(chain_ID,chain_name,crediter_chain_ID,crediter_chain_name,product_ID,product_name,list_price,list_price_subtotal,cost_price,subtotal,amount,crediter_ID,crediter_name) values('"
                                  + aaa[0]
                                  + "','"
                                  + aaa[1]
                                  + "','"
                                  + aaa1[0]
                                  + "','"
                                  + aaa1[1]
                                  + "','"
                                  + product_IDn[i]
                                  + "','"
                                  + product_namen[i]
                                  + "','"
                                  + list_price
                                  + "','"
                                  + list_price_subtotal
                                  + "','"
                                  + cost_pricen[i]
                                  + "','"
                                  + subtotal
                                  + "','"
                                  + amountn[i]
                                  + "','"
                                  + payer_ID
                                  + "','"
                                  + payer_name
                                  + "')";
                          crm_db.executeUpdate(sql95);
                        }
                      }
                      // ***************************
                    }
                  }
                  String sql =
                      "update stock_apply_pay set reason='"
                          + reason
                          + "',register='"
                          + register
                          + "',register_time='"
                          + register_time
                          + "',demand_return_time='"
                          + demand_return_time
                          + "',register_time='"
                          + register_time
                          + "',register='"
                          + register
                          + "',remark='"
                          + remark
                          + "',demand_amount='"
                          + demand_amount
                          + "',list_price_sum='"
                          + list_price_sum
                          + "',cost_price_sum='"
                          + cost_price_sum
                          + "',not_return_tag='"
                          + not_return_tag
                          + "' where pay_ID='"
                          + pay_ID
                          + "'";
                  stock_db.executeUpdate(sql);
                  if (flag) {
                    sql = "update stock_apply_pay set check_tag='1' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    if (!vr.validata(
                        (String) dbSession.getAttribute("unit_db_name"),
                        "stock_pay",
                        "reasonexact",
                        pay_ID)) {
                      String sql4 =
                          "insert into stock_pay(pay_ID,reason,reasonexact,reasonexact_details,demand_amount,list_price_sum,cost_price_sum,register,register_time) values('"
                              + stock_pay_ID
                              + "','"
                              + reason
                              + "','"
                              + pay_ID
                              + "','"
                              + payer_name
                              + "','"
                              + demand_amount
                              + "','"
                              + list_price_sum
                              + "','"
                              + cost_price_sum
                              + "','"
                              + register
                              + "','"
                              + register_time
                              + "')";
                      stock_db.executeUpdate(sql4);
                    }

                    String sql98 = "select * from crm_file where customer_ID='" + payer_ID + "'";
                    ResultSet rs98 = crm_db.executeQuery(sql98);
                    if (rs98.next()) {
                      double salecredit_list_price_sum =
                          rs98.getDouble("salecredit_list_price_sum") + list_price_sum;
                      double salecredit_cost_price_sum =
                          rs98.getDouble("salecredit_cost_price_sum") + cost_price_sum;

                      String sql99 =
                          "update crm_file set credit_yes_or_not_tag='1',salecredit_list_price_sum='"
                              + salecredit_list_price_sum
                              + "',salecredit_cost_price_sum='"
                              + salecredit_cost_price_sum
                              + "' where customer_ID='"
                              + payer_ID
                              + "' ";
                      crm_db.executeUpdate(sql99);
                    }
                  } else {
                    sql = "update stock_apply_pay set check_tag='0' where pay_ID='" + pay_ID + "'";
                    stock_db.executeUpdate(sql);
                    Iterator ite = rsList.iterator();
                    while (ite.hasNext()) {
                      elem = (String[]) ite.next();
                      sql =
                          "insert into crm_workflow(config_id,object_ID,describe1,describe2) values ('"
                              + elem[0]
                              + "','"
                              + pay_ID
                              + "','"
                              + elem[1]
                              + "','"
                              + elem[2]
                              + "')";
                      crm_db.executeUpdate(sql);
                    }
                  }

                  response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=8");
                } else {

                  response.sendRedirect(
                      "draft/crm/credit_ok.jsp?finished_tag=7&pay_ID=" + pay_ID + "");
                }
              } catch (Exception ex) {
                ex.printStackTrace();
              }
            } else {

              response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=6&pay_ID=" + pay_ID + "");
            }
          } else {

            response.sendRedirect("draft/crm/credit_ok.jsp?finished_tag=9");
          }
        }
        stock_db.commit();
        crm_db.commit();
        stock_db.close();
        crm_db.close();
      } else {
        response.sendRedirect("error_conn.htm");
      }
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
  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");
      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("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<!--%@ page errorPage=\"/error.jsp\" %-->\n");

      response.setHeader("Pragma", "no-cache"); // HTTP 1.0
      response.setDateHeader("Expires", 0);
      response.setHeader("Cache-Control", "no-cache"); // HTTP 1.1

      String _adminid = "";
      String _adminname = "";
      String _admintype = "";
      String _admingroup = "";
      String _approval = "";
      String _adminclass = "";
      String _adminmail = "";

      try {

        _adminid = (String) session.getAttribute("adminid");

        if (_adminid == null || _adminid.length() == 0 || _adminid.equals("null")) {
          response.sendRedirect("/admin/login_first.html");
          return;
        }

        _adminname = (String) session.getAttribute("adminname");
        _admintype = (String) session.getAttribute("admintype");
        _admingroup = (String) session.getAttribute("admingroup");
        _approval = (String) session.getAttribute("approval");
        _adminclass = (String) session.getAttribute("adminclass");
        _adminmail = (String) session.getAttribute("admin_email");
        // session.setMaxInactiveInterval(60*60);

      } catch (Exception e) {
        response.sendRedirect("/admin/login_first.html");
        return;
      }

      out.write('\n');
      out.write('\n');
      out.write('\n');

      String password = request.getParameter("password");
      String fromURL = request.getParameter("fromURL");
      String oldPassword = "";

      String sql = "";
      int iCnt = 0;
      boolean isSucceeded = false;
      String strMsg = "";
      Connection conn = null;
      MatrixDataSet matrix = null;
      DataProcess dataProcess = null;
      PreparedStatement pstmt = null;

      String targetUrl = "";

      try {

        if (password.equals("1111")) {
          throw new UserDefinedException(
              "The new password is not acceptable. Change your password.");
        }

        Context ic = new InitialContext();
        DataSource ds = (DataSource) ic.lookup("java:comp/env/jdbc/scm");
        conn = ds.getConnection();
        matrix = new dbconn.MatrixDataSet();
        dataProcess = new DataProcess();

        sql =
            " select  password " + " from    admin_01t " + " where   adminid = '" + _adminid + "' ";

        iCnt = dataProcess.RetrieveData(sql, matrix, conn);

        if (iCnt > 0) {
          oldPassword = matrix.getRowData(0).getData(0);
        } else {
          throw new UserDefinedException("Can't find User Information.");
        }

        if (password.equals(oldPassword)) {
          throw new UserDefinedException(
              "The new password is not acceptable. Change your password.");
        }

        // update ó¸®...
        int idx = 0;
        conn.setAutoCommit(false);

        sql =
            " update  admin_01t "
                + " set     password = ?, pw_date = sysdate() "
                + " where   adminid = ? ";

        pstmt = conn.prepareStatement(sql);
        pstmt.setString(++idx, password);
        pstmt.setString(++idx, _adminid);

        iCnt = pstmt.executeUpdate();

        if (iCnt != 1) {
          throw new UserDefinedException("Password update failed.");
        }

        conn.commit();
        isSucceeded = true;

      } catch (UserDefinedException ue) {
        try {
          conn.rollback();
        } catch (Exception ex) {
        }

        strMsg = ue.getMessage();
      } catch (Exception e) {
        try {
          conn.rollback();
        } catch (Exception ex) {
        }

        System.out.println("Exception /admin/resetAdminPasswd : " + e.getMessage());
        throw e;
      } finally {
        if (pstmt != null) {
          try {
            pstmt.close();
          } catch (Exception e) {
          }
        }

        if (conn != null) {
          try {
            conn.setAutoCommit(true);
          } catch (Exception e) {
          }
          conn.close();
        }
      }

      // °á°ú ¸Þ½ÃÁö ó¸®
      if (isSucceeded) {
        // where to go?
        if (fromURL.equals("menu")) {
          targetUrl = "";
        } else {
          targetUrl = "/admin/index2.jsp";
        }
        strMsg = "The data are successfully processed.";
      } else {
        strMsg = "The operation failed.\\n" + strMsg;
        targetUrl = "/admin/resetAdminPasswdForm.jsp";
      }

      out.write("\n");
      out.write("<html>\n");
      out.write("<head>\n");
      out.write("<title></title>\n");
      out.write("<link href=\"/common/css/style.css\" rel=\"stylesheet\" type=\"text/css\">\n");
      out.write("</head>\n");
      out.write("<body leftmargin='0' topmargin='0' marginwidth='0' marginheight='0'>\n");
      out.write("<form name=\"form1\" method=\"post\" action=\"");
      out.print(targetUrl);
      out.write("\">\n");
      out.write("<input type='hidden' name='fromURL' value='");
      out.print(fromURL);
      out.write("'>\n");
      out.write("</form>\n");
      out.write("<script language=\"javascript\">\n");
      if (targetUrl.length() > 0) {
        out.write("\n");
        out.write("  alert('");
        out.print(strMsg);
        out.write("');\n");
        out.write("  document.form1.submit();\n");
      }
      out.write("\n");
      out.write("</script>\n");
      out.write("<table width='840' border='0' cellspacing='0' cellpadding='0'><tr><td>\n");
      out.write("\n");
      out.write("<table width='99%' border='0' cellspacing='0' cellpadding='0'>\n");
      out.write("<tr>\n");
      out.write("  <td height='15' colspan='2'></td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td width='3%'><img src='/img/title_icon.gif'></td>\n");
      out.write("  <td width='*' class='left_title'>Password Change</td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td width='100%' height='2' colspan='2'><hr width='100%'></td>\n");
      out.write("</tr>\n");
      out.write("<tr>\n");
      out.write("  <td height='10' colspan='2'></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");
      out.write("\n");
      out.write("<table width='90%' border='0' cellspacing='0' cellpadding='0' align='center'>\n");
      out.write("<tr>\n");
      out.write("  <td width='100%' align='center'><img border=\"0\" src=\"/img/pass.jpg\">\n");
      out.write("    <br><br>\n");
      out.write("    <b>The Password has been changed successfully.</b></td>\n");
      out.write("</tr>\n");
      out.write("</table>\n");

      out.println(CopyRightLogo());

      out.write("\n");
      out.write("</tr></td></table>\n");
      out.write("</body>\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);
    }
  }
Beispiel #29
0
  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;
      _jspx_resourceInjector =
          (org.glassfish.jsp.api.ResourceInjector)
              application.getAttribute("com.sun.appserv.jsp.resource.injector");

      out.write("\r\n");
      out.write("\r\n");
      out.write("\r\n");
      out.write("<!DOCTYPE html>\r\n");
      out.write("\r\n");
      out.write("<html>\r\n");
      out.write("<head><title>Calculator</title></head>\r\n");
      out.write("<body>\r\n");
      out.write("    ");

      String plasA = request.getParameter("plusA");
      String plasB = request.getParameter("plusB");
      String multiplyA = request.getParameter("multiplyA");
      String multiplyB = request.getParameter("multiplyB");

      if (plasA != null && !plasA.isEmpty() && !plasB.isEmpty()) {
        try {
          int result = Integer.parseInt(plasA) + Integer.parseInt(plasB);
          request.setAttribute("plusRequest", result);
          request.setAttribute("plusA", plasA);
          request.setAttribute("plusB", plasB);
        } catch (Exception e) {

        }
      } else {
        request.setAttribute("plusRequest", "");
        request.setAttribute("plusA", plasA);
        request.setAttribute("plusB", plasB);
      }
      if (multiplyA != null && !multiplyA.isEmpty() && !multiplyB.isEmpty()) {
        try {
          int result = Integer.parseInt(multiplyA) * Integer.parseInt(multiplyB);
          request.setAttribute("mutilplyResult", result);
          request.setAttribute("multiplyA", multiplyA);
          request.setAttribute("multiplyB", multiplyB);
          // out.printf("<br/><span>%s*%s=%d</span>",multiplyA,multiplyB,result);
        } catch (Exception e) {
          out.print(e.getMessage());
        }

      } else {
        request.setAttribute("mutilplyResult", "");
        request.setAttribute("multiplyA", multiplyA);
        request.setAttribute("multiplyB", multiplyB);
      }

      out.write("\r\n");
      out.write(" <form  method=\"post\" id=\"myForm\">\r\n");
      out.write("        <div class=\"plus\">\r\n");
      out.write("            <p><input type=\"text\"  name=\"plusA\" value=\"");
      out.print(request.getAttribute("plusA") == null ? "" : request.getAttribute("plusA"));
      out.write("\" /><span>+</span>\r\n");
      out.write("                <input type=\"text\" value=\"");
      out.print(request.getAttribute("plusB") == null ? "" : request.getAttribute("plusB"));
      out.write("\" name=\"plusB\">\r\n");
      out.write("                <span>=</span><input type=\"text\" id=\"plusResult\" value=\"");
      out.print(request.getAttribute("plusRequest"));
      out.write("\"/>\r\n");
      out.write("                </p>\r\n");
      out.write("        </div>\r\n");
      out.write("         <div class=\"multiply\">\r\n");
      out.write("            <p><input type=\"text\" value=\"");
      out.print(request.getAttribute("multiplyA") == null ? "" : request.getAttribute("multiplyA"));
      out.write("\" name=\"multiplyA\"><span>*</span>\r\n");
      out.write("                <input type=\"text\" value=\"");
      out.print(request.getAttribute("multiplyB") == null ? "" : request.getAttribute("multiplyB"));
      out.write("\" name=\"multiplyB\">\r\n");
      out.write(
          "                <span>=</span><input type=\"text\" id=\"multiplyResult\" value=\"");
      out.print(request.getAttribute("mutilplyResult"));
      out.write("\" />\r\n");
      out.write("            </p>\r\n");
      out.write("        </div>\r\n");
      out.write("        <div><input type=\"submit\" value=\"Submit\" id=\"submit\"/></div>\r\n");
      out.write("        <div id=\"result\"></div>\r\n");
      out.write("        </form>\r\n");
      out.write("\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
      out.write("\r\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    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 {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html");
      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');
      out.write('\n');
      try {
        out.write("\r\n\r\n ");

        String wgID = request.getParameter("wgID");
        final WorkgroupManager workgroupManager = WorkgroupManager.getInstance();
        Workgroup workgroup = workgroupManager.getWorkgroup(new JID(wgID));

        OfflineSettingsManager offlineManager = new OfflineSettingsManager();
        String redirectValue = request.getParameter("redirectToPage");
        String statusMessage = "";

        OfflineSettings offlineSettings = null;

        boolean emailConfigured = false;

        String property = JiveGlobals.getProperty("mail.configured");
        if (ModelUtil.hasLength(property)) {
          emailConfigured = true;
        }

        boolean delete = request.getParameter("delete") != null;
        boolean save = request.getParameter("save") != null && !delete;

        if (save) {
          String emailAddress = request.getParameter("email");
          String subject = request.getParameter("subject");
          String header = request.getParameter("headerField");
          offlineSettings =
              offlineManager.saveOfflineSettings(
                  workgroup, redirectValue, emailAddress, subject, header);
          if (offlineSettings != null) {
            statusMessage = "Offline settings have been saved.";
          }
        } else if (delete) {
          statusMessage = "Offline settings have been deleted.";
          offlineSettings =
              offlineManager.saveOfflineSettings(workgroup, redirectValue, "", "", "");
        } else {
          try {
            offlineSettings = offlineManager.getOfflineSettings(workgroup);
          } catch (OfflineSettingsNotFound offlineSettingsNotFound) {
            offlineSettings = new OfflineSettings();
          }
        }

        out.write("\r\n<html>\r\n    <head>\r\n        <title>");
        out.print("Offline Settings for " + wgID);
        out.write(
            "</title>\r\n        <meta name=\"subPageID\" content=\"workgroup-offline\"/>\r\n        <meta name=\"extraParams\" content=\"");
        out.print("wgID=" + wgID);
        out.write(
            "\"/>\r\n        <!--<meta name=\"helpPage\" content=\"set_an_offline_policy_for_a_workgroup.html\"/>-->\r\n\r\n        <script>\r\n        function saveOfflineSettings(){\r\n             var todo = document.offline.todo;\r\n             if(todo[0].checked){\r\n                 var url = document.offline.redirectToPage.value;\r\n                 if(!Jtrim(url)){\r\n                   alert(\"Please specify the URL to forward to.\");\r\n                   document.offline.redirectToPage.focus();\r\n                   return;\r\n                 }\r\n                 document.offline.email.value = \"\";\r\n                 document.offline.subject.value = \"\";\r\n                 document.offline.headerField.value = \"\";\r\n\r\n                 document.offline.submit();\r\n             }\r\n             else if(todo[1].checked){\r\n               var email = document.offline.email.value;\r\n               var subject = document.offline.subject.value;\r\n               var message = document.offline.headerField.value;\r\n               document.offline.redirectToPage.value = '';\r\n");
        out.write(
            "\r\n               if(!Jtrim(email) || !Jtrim(subject) || !Jtrim(message)){\r\n                 alert(\"All fields are required.\");\r\n                 return;\r\n               }\r\n                document.offline.submit();\r\n             }\r\n        }\r\n\r\n\r\n\r\n         function Jtrim(st) {\r\n             var len = st.length;\r\n             var begin = 0, end = len - 1;\r\n             while (st.charAt(begin) == \" \" && begin < len) {\r\n                 begin++;\r\n             }\r\n             while (st.charAt(end) == \" \" && end > begin) {\r\n                 end--;\r\n             }\r\n             return st.substring(begin, end + 1);\r\n         }\r\n        </script>\r\n    </head>\r\n    <body>\r\n    Specify action to take when this workgroup has no available agents to take incoming chat requests.\r\n    ");
        if (statusMessage != null && !statusMessage.equals("")) {
          out.write("\r\n    <div class=\"success\">\r\n        ");
          out.print(statusMessage);
          out.write("\r\n    </div>\r\n    ");
        }
        out.write("\r\n\r\n      ");
        if (!emailConfigured) {
          out.write(
              "\r\n            <div class=\"error\">\r\n                Email form will not be displayed until you configure your <a href=\"../../system-email.jsp\">email settings</a>.\r\n            </div>\r\n    ");
        }
        out.write("\r\n\r\n    <div id=\"offline_message\">");
        out.print(statusMessage);
        out.write(
            "</div>\r\n    <p/>\r\n    <form action=\"workgroup-offline.jsp\" method=\"get\" name=\"offline\">\r\n    <input type=\"hidden\" name=\"wgID\" value=\"");
        out.print(wgID);
        out.write(
            "\" />\r\n    <div>\r\n        <div class=\"jive-contentBoxHeader\">\r\n        Offline Workgroup Action\r\n        </div>\r\n        <table width=\"100%\" cellpadding=\"3\" cellspacing=\"0\" border=\"0\" class=\"jive-contentBox\">\r\n                <tr valign=\"top\">\r\n                ");
        String checked = offlineSettings.redirects() ? "checked" : "";
        out.write(
            "\r\n                            <td width=\"1%\">\r\n                                <input type=\"radio\" name=\"todo\" value=\"redirectToPage\" ");
        out.print(checked);
        out.write(
            " />\r\n                            </td>\r\n                            <td nowrap><b>Redirect To Web Page</b>\r\n                               </td>\r\n                            <td class=\"c2\">\r\n                                <input type=\"text\" name=\"redirectToPage\" size=\"40\" value=\"");
        out.print(offlineSettings.getRedirectURL());
        out.write(
            "\" /><br/>\r\n                                 <span class=\"jive-description\">e.g. http://www.jivesoftware.com/contact.html</span>\r\n                            </td>\r\n                </tr>\r\n                <tr>\r\n                    <td nowrap width=\"1%\">\r\n                         <input type=\"radio\" name=\"todo\" value=\"showEmailPage\" ");
        out.print(!offlineSettings.redirects() ? "checked" : "");
        out.write(
            "/>\r\n                         <td><b>Display Email Form</b></td>\r\n                     </td>\r\n                     <td>&nbsp;</td>\r\n                </tr>\r\n                <!-- Email Address -->\r\n                <tr valign=\"top\">\r\n                    <td>&nbsp;</td>\r\n                    <td>Email Address:</td>\r\n                    <td>\r\n                        <input type=\"text\" size=\"40\" name=\"email\" value=\"");
        out.print(offlineSettings.getEmailAddress());
        out.write(
            "\" /><br/>\r\n                        <span class=\"jive-description\">Email address to send all offline messages to.</span>\r\n                    </td>\r\n                </tr>\r\n                <!-- End of Email Address -->\r\n                <!-- Subject Line -->\r\n                 <tr valign=\"top\">\r\n                    <td>&nbsp;</td>\r\n                    <td>Subject:</td>\r\n                    <td>\r\n                        <input type=\"text\" size=\"40\" name=\"subject\" value=\"");
        out.print(offlineSettings.getSubject());
        out.write(
            "\"/><br/>\r\n                        <span class=\"jive-description\">The subject of all offline email messages.</span>\r\n                    </td>\r\n                </tr>\r\n                <!--  End Of Subject Line -->\r\n                <tr valign=\"top\">\r\n                     <td>&nbsp;</td>\r\n                    <td>Offline Text:</td>\r\n                    <td>\r\n                        <textarea name=\"headerField\" cols=\"40\" rows=\"5\">");
        out.print(offlineSettings.getOfflineText());
        out.write(
            "</textarea><br/>\r\n                        <span class=\"jive-description\">Text to display to the user in the email form.</span>\r\n                    </td>\r\n                </tr>\r\n                    <input type=\"hidden\" name=\"save\" value=\"save\">\r\n                 <tr>\r\n                </tr>\r\n            ");
        out.write(
            "\r\n            </table>\r\n            <table><tr>\r\n                 <td colspan=\"1\"> <input type=\"button\" name=\"save\" value=\"Save Changes\" onclick=\"return saveOfflineSettings();\" /></td>\r\n                <td colspan=\"1\"> <input type=\"submit\" name=\"delete\" value=\"Delete Changes\" /></td>\r\n            </tr></table>\r\n       </div>\r\n    </form>\r\n\r\n</body>\r\n</html>\r\n\r\n");
      } catch (Exception ex) {
        ex.printStackTrace();
      }
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }