Esempio n. 1
0
  @Override
  public void init(Context context, Properties initProps) {
    initProps = decryptPwd(initProps);
    Object o = initProps.get(CONVERT_TYPE);
    if (o != null) convertType = Boolean.parseBoolean(o.toString());

    factory = createConnectionFactory(context, initProps);

    String bsz = initProps.getProperty("batchSize");
    if (bsz != null) {
      bsz = context.replaceTokens(bsz);
      try {
        batchSize = Integer.parseInt(bsz);
        if (batchSize == -1) batchSize = Integer.MIN_VALUE;
      } catch (NumberFormatException e) {
        LOG.warn("Invalid batch size: " + bsz);
      }
    }

    for (Map<String, String> map : context.getAllEntityFields()) {
      String n = map.get(DataImporter.COLUMN);
      String t = map.get(DataImporter.TYPE);
      if ("sint".equals(t) || "integer".equals(t)) fieldNameVsType.put(n, Types.INTEGER);
      else if ("slong".equals(t) || "long".equals(t)) fieldNameVsType.put(n, Types.BIGINT);
      else if ("float".equals(t) || "sfloat".equals(t)) fieldNameVsType.put(n, Types.FLOAT);
      else if ("double".equals(t) || "sdouble".equals(t)) fieldNameVsType.put(n, Types.DOUBLE);
      else if ("date".equals(t)) fieldNameVsType.put(n, Types.DATE);
      else if ("boolean".equals(t)) fieldNameVsType.put(n, Types.BOOLEAN);
      else if ("binary".equals(t)) fieldNameVsType.put(n, Types.BLOB);
      else fieldNameVsType.put(n, Types.VARCHAR);
    }
  }
Esempio n. 2
0
  public static void init() throws ServletException {
    try {
      // récupération de la source de donnée
      Context initCtx = new InitialContext();
      ds = (DataSource) initCtx.lookup("java:comp/env/jdbc/digitlibpool");

    } catch (Exception e) {
      throw new UnavailableException(e.getMessage());
    }
  }
Esempio n. 3
0
 private void resolveVariables(Context ctx, Properties initProps) {
   for (Map.Entry<Object, Object> entry : initProps.entrySet()) {
     if (entry.getValue() != null) {
       entry.setValue(ctx.replaceTokens((String) entry.getValue()));
     }
   }
 }
Esempio n. 4
0
  /** Constructor for LDAPQuery. */
  public JNDITomcat() throws Exception {
    super();

    Hashtable<String, String> env = new Hashtable<String, String>();

    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
    env.put(Context.PROVIDER_URL, "jndi://nadetrou2:8080/");

    // Obtain our environment naming context

    Context initCtx = new InitialContext(env);

    // Context envCtx = (Context) initCtx.lookup("comp/env");

    // Look up our data source

    // DataSource datasource = (DataSource)
    // initialContext.lookup((String)settings.get(CONNECTION_POOL_NAME));

    DataSource ds = (DataSource) initCtx.lookup("/jdbc/vrdb");

    // Allocate and use a connection from the pool

    Connection conn = ds.getConnection();

    System.out.println(conn);
    // ... use this connection to access the database ...

    conn.close();

    // Hashtable env = new Hashtable();
    // //env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    // //env.put(Context.PROVIDER_URL, "t3://192.168.0.55:17001/" );
    //
    // env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    // env.put(Context.PROVIDER_URL, "3://127.0.0.1:7001/" );
    //
    // // env.put(Context.SECURITY_PRINCIPAL, "system");
    // // env.put(Context.SECURITY_CREDENTIALS, "12345678");
    // System.out.println(env);
    // //System.out.println("--A");
    // // Create initial context
    // DirContext ctx = new InitialDirContext(env);

    // exploreNext(0, envCtx, "");
  }
Esempio n. 5
0
  /**
   * Se conecta a un servicio JDBC usando java.naming. Los parametros de configuracion se manejan
   * para el contexto de la aplicacion, permitiendo un pool de conexiónes persistentes disponibles
   * para toda la aplicacion. Tomcat proporciona este servicio configurandolo en el archivo web.xml
   * o server.xml
   *
   * @param servicio Una cadena como "java:comp/env/servicio"
   */
  protected boolean conectar(String servicio) throws Exception {

    /*
     *Para conectarse con Tomcat
     *en el archivo de coniguracion se especifican
     *los parametros de conexión.
     */
    long t = System.currentTimeMillis();
    // Context es un objeto que encapsula el contexto de la aplicacion
    Context ctx = new InitialContext();
    // DataSource es el origen de datos,
    // un servicio JDBC proporcionado mediante java naming
    // El nombre del servicio deberia ser recibido como
    // argumento
    DataSource ds = (DataSource) ctx.lookup(servicio);

    // Ahora si obtiene la conexión
    this.conexión = ds.getConnection();

    return this.conexión != null;
  } // Fin conectar
 public static void createConnectionPool() {
   Context context;
   try {
     context = new InitialContext();
     Class.forName("org.firebirdsql.jdbc.FBDriver");
     ds = (DataSource) context.lookup("java:comp/env/jdbc/PanelTrackDB");
     Connection c = ds.getConnection();
   } catch (NamingException e) {
     // TODO Auto-generated catch block
     errorLogger.error("An Error Occured:", e);
     e.printStackTrace();
   } catch (ClassNotFoundException e) {
     errorLogger.error("An Error Occured:", e);
     // TODO Auto-generated catch block
     e.printStackTrace();
   } catch (SQLException e) {
     errorLogger.error("An Error Occured:", e);
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
  public static Connection obtenerConexion() throws NamingException {
    Connection conexion = null;

    try {
      // Creamos un contexto jndi inicial
      // Este context no tiene nada que ver con
      // la etiqueta contexto donde esta el pool

      // Este context hace referencia un servicio de nombres
      // naming service
      Context ctx = new InitialContext();
      String nombreDelContextJNDI = "java:comp/env/";
      DataSource ds = (DataSource) ctx.lookup(nombreDelContextJNDI + "jdbc/MySqlPoolConections");

      conexion = ds.getConnection();

    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
    return conexion;
  }
  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);
    }
  }
Esempio n. 9
0
  protected Callable<Connection> createConnectionFactory(
      final Context context, final Properties initProps) {
    //    final VariableResolver resolver = context.getVariableResolver();
    resolveVariables(context, initProps);
    final String jndiName = initProps.getProperty(JNDI_NAME);
    final String url = initProps.getProperty(URL);
    final String driver = initProps.getProperty(DRIVER);

    if (url == null && jndiName == null)
      throw new DataImportHandlerException(SEVERE, "JDBC URL or JNDI name has to be specified");

    if (driver != null) {
      try {
        DocBuilder.loadClass(driver, context.getSolrCore());
      } catch (ClassNotFoundException e) {
        wrapAndThrow(SEVERE, e, "Could not load driver: " + driver);
      }
    } else {
      if (jndiName == null) {
        throw new DataImportHandlerException(
            SEVERE, "One of driver or jndiName must be specified in the data source");
      }
    }

    String s = initProps.getProperty("maxRows");
    if (s != null) {
      maxRows = Integer.parseInt(s);
    }

    return factory =
        new Callable<Connection>() {
          @Override
          public Connection call() throws Exception {
            LOG.info(
                "Creating a connection for entity "
                    + context.getEntityAttribute(DataImporter.NAME)
                    + " with URL: "
                    + url);
            long start = System.nanoTime();
            Connection c = null;

            if (jndiName != null) {
              c = getFromJndi(initProps, jndiName);
            } else if (url != null) {
              try {
                c = DriverManager.getConnection(url, initProps);
              } catch (SQLException e) {
                // DriverManager does not allow you to use a driver which is not loaded through
                // the class loader of the class which is trying to make the connection.
                // This is a workaround for cases where the user puts the driver jar in the
                // solr.home/lib or solr.home/core/lib directories.
                Driver d =
                    (Driver) DocBuilder.loadClass(driver, context.getSolrCore()).newInstance();
                c = d.connect(url, initProps);
              }
            }
            if (c != null) {
              try {
                initializeConnection(c, initProps);
              } catch (SQLException e) {
                try {
                  c.close();
                } catch (SQLException e2) {
                  LOG.warn("Exception closing connection during cleanup", e2);
                }

                throw new DataImportHandlerException(
                    SEVERE, "Exception initializing SQL connection", e);
              }
            }
            LOG.info(
                "Time taken for getConnection(): "
                    + TimeUnit.MILLISECONDS.convert(
                        System.nanoTime() - start, TimeUnit.NANOSECONDS));
            return c;
          }

          private void initializeConnection(Connection c, final Properties initProps)
              throws SQLException {
            if (Boolean.parseBoolean(initProps.getProperty("readOnly"))) {
              c.setReadOnly(true);
              // Add other sane defaults
              c.setAutoCommit(true);
              c.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
              c.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
            }
            if (!Boolean.parseBoolean(initProps.getProperty("autoCommit"))) {
              c.setAutoCommit(false);
            }
            String transactionIsolation = initProps.getProperty("transactionIsolation");
            if ("TRANSACTION_READ_UNCOMMITTED".equals(transactionIsolation)) {
              c.setTransactionIsolation(Connection.TRANSACTION_READ_UNCOMMITTED);
            } else if ("TRANSACTION_READ_COMMITTED".equals(transactionIsolation)) {
              c.setTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
            } else if ("TRANSACTION_REPEATABLE_READ".equals(transactionIsolation)) {
              c.setTransactionIsolation(Connection.TRANSACTION_REPEATABLE_READ);
            } else if ("TRANSACTION_SERIALIZABLE".equals(transactionIsolation)) {
              c.setTransactionIsolation(Connection.TRANSACTION_SERIALIZABLE);
            } else if ("TRANSACTION_NONE".equals(transactionIsolation)) {
              c.setTransactionIsolation(Connection.TRANSACTION_NONE);
            }
            String holdability = initProps.getProperty("holdability");
            if ("CLOSE_CURSORS_AT_COMMIT".equals(holdability)) {
              c.setHoldability(ResultSet.CLOSE_CURSORS_AT_COMMIT);
            } else if ("HOLD_CURSORS_OVER_COMMIT".equals(holdability)) {
              c.setHoldability(ResultSet.HOLD_CURSORS_OVER_COMMIT);
            }
          }

          private Connection getFromJndi(final Properties initProps, final String jndiName)
              throws NamingException, SQLException {

            Connection c = null;
            InitialContext ctx = new InitialContext();
            Object jndival = ctx.lookup(jndiName);
            if (jndival instanceof javax.sql.DataSource) {
              javax.sql.DataSource dataSource = (javax.sql.DataSource) jndival;
              String user = (String) initProps.get("user");
              String pass = (String) initProps.get("password");
              if (user == null || user.trim().equals("")) {
                c = dataSource.getConnection();
              } else {
                c = dataSource.getConnection(user, pass);
              }
            } else {
              throw new DataImportHandlerException(
                  SEVERE, "the jndi name : '" + jndiName + "' is not a valid javax.sql.DataSource");
            }
            return c;
          }
        };
  }
  public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    javax.servlet.jsp.PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html;charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

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

      // This JSP handles cross context communications from wt-monitor
      // to wt-core for use in accessing wt-core functionality that is
      // needed in WTnav-tree.jsp.

      // Assign a pooled DB connection handle
      Context ctx = new InitialContext();
      DataSource ds = (DataSource) ctx.lookup(WTConstants.WATCHTOWERDB_CONN);
      int iIndex = 6100;
      GraphViewManager graphman = new GraphViewManager(ds);
      // Vector views = graphman.getViews();

      Vector views = new Vector();
      WTOrganization[] orgs = null;

      WTAccountCredentials ac =
          (WTAccountCredentials)
              request.getSession().getAttribute(WTAccountCredentials.SESSION_ATTRIBUTE_AC);
      if (ac != null) {
        // WTOrganization[] orgs = null;
        int selectedOrg = ac.getCurrentManagedId();

        boolean siteUser = ac.getIsSiteUser();
        int userId = ac.getUserId();

        // Get list of organizations for the current user
        if (siteUser) {
          try {
            orgs = DAOImpl.OrgDAO.getWTOrganization();
          } catch (Exception e) {
            e.printStackTrace();
          }
        } else {
          if (!(userId < 0)) {
            try {
              orgs = DAOImpl.OrgDAO.getWTOrganizationsByUser(userId);
            } catch (Exception e) {
              e.printStackTrace();
            }
          }
        }

        // Get the list of actively managed nodes
        if (selectedOrg == WTAccountCredentials.ALL_ORGS) {
          if (siteUser) {
            views = graphman.getViews();
          } else {
            if (orgs != null) {
              int[] orgsIds = new int[orgs.length];
              for (int i = 0; i < orgs.length; i++) {
                orgsIds[i] = orgs[i].getID();
              }
              views = graphman.getViews(orgsIds);
            }
          }
        } else {
          views = graphman.getViews(selectedOrg);
        }
      }

      // My Graph Views is an experimental feature and is commented out until all kinks are worked
      // out. LS

      String strOutput = null;
      // 	if( views.size()==0 ) {
      //		strOutput = "nav.add(6100, 6000, 'My Graph Views', '/wt-monitor/report/index.jsp', 'My
      // Customized Graph Views', 'mainContentsFrame', icon16_basedir + 'bs_chart.gif',
      // icon16_basedir + 'bs_chart.gif', '');\r\n";
      //	} else {
      //		strOutput = "nav.add(6100, 6000, 'My Graph Views', '', 'My Customized Graph Views',
      // 'mainContentsFrame', icon16_basedir + 'bs_chart.gif', icon16_basedir + 'bs_chart.gif',
      // '');\r\n";
      //	}
      //	for (int i=0; i<views.size(); i++)
      //	{
      //		iIndex++;
      //		String strViewName = ((GraphViewJB)views.elementAt(i)).getName();
      //		int strOrgId = ((GraphViewJB)views.elementAt(i)).getOrgId();
      //		String orgName = null;
      //       for(int j=0;j<orgs.length;j++){
      //	        if(orgs[j].getID() != -1 && orgs[j].getID() == strOrgId){
      //	        	orgName = orgs[j].getName();
      //	        }
      //		}
      //
      //		strOutput +="nav.add(" + iIndex +
      //		            ", 6100, '" + strViewName +
      //		            "', 'javascript:
      // PopupCenteredWindow(\\'/wt-core/jsp/sysmon/graphview/GraphView.jsp?view=" + strViewName +
      // "&orgname="+orgName +"&start=01&end=02" + "\\', \\'graphview\\', \\'yes\\', \\'yes\\',
      // \\'yes\\', \\'900\\', \\'1010\\'); location.href=\\'/wt-monitor/wt-jsp/WTnav-tree.jsp\\';',
      // 'Open " + strViewName + " Graph View', '', icon16_basedir + 'bs_chart.gif', icon16_basedir
      // + 'bs_chart.gif', '');\r\n";
      // }

      out.write("\n\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n\n");
      out.print(strOutput);
      out.write("\n");
    } catch (Throwable t) {
      out = _jspx_out;
      if (out != null && out.getBufferSize() != 0) out.clearBuffer();
      if (pageContext != null) pageContext.handlePageException(t);
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(pageContext);
    }
  }
  public void _jspService(
      final javax.servlet.http.HttpServletRequest request,
      final javax.servlet.http.HttpServletResponse response)
      throws java.io.IOException, javax.servlet.ServletException {

    final javax.servlet.jsp.PageContext pageContext;
    javax.servlet.http.HttpSession session = null;
    final javax.servlet.ServletContext application;
    final javax.servlet.ServletConfig config;
    javax.servlet.jsp.JspWriter out = null;
    final java.lang.Object page = this;
    javax.servlet.jsp.JspWriter _jspx_out = null;
    javax.servlet.jsp.PageContext _jspx_page_context = null;

    try {
      response.setContentType("text/html");
      pageContext =
          _jspxFactory.getPageContext(
              this,
              request,
              response,
              "ReportErrorPage.jsp?page=EditTargetReportForm.jsp",
              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");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "header.jsp", out, false);
      out.write(' ');
      out.write('\n');
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\t<!-- files for JqxWidget grid  -->\n");
      out.write(
          "    <link rel=\"stylesheet\" href=\"js/jqwidgets/styles/jqx.base.css\" type=\"text/css\" />\n");
      out.write(
          "    <link rel=\"stylesheet\" href=\"js/jqwidgets/styles/jqx.darkblue.css\" type=\"text/css\" />\n");
      out.write(
          "\t<link rel=\"stylesheet\" href=\"js/jqwidgets/styles/jqx.ui-redmond.css\" type=\"text/css\" />\n");
      out.write("\t\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/gettheme.js\"></script>\n");
      out.write("\t<script type=\"text/javascript\" src=\"js/jquery-1.10.2.min.js\"></script>\n");
      out.write("    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxcore.js\"></script>\n");
      out.write("    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxdata.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxbuttons.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxscrollbar.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxlistbox.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxcalendar.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxdatetimeinput.js\"></script>\n");
      out.write("    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.filter.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.selection.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.sort.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.pager.js\"></script>\n");
      out.write(
          "     <script type=\"text/javascript\" src=\"js/jqwidgets/jqxmenu.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxlistbox.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxdropdownlist.js\"></script>\n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxdata.export.js\"></script> \n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.export.js\"></script> \n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.aggregates.js\"></script>  \n");
      out.write(
          "    <script type=\"text/javascript\" src=\"js/jqwidgets/jqxgrid.grouping.js\"></script> \n");
      out.write("\n");
      out.write("\n");
      out.write("\t\n");
      out.write("\t");

      session.getAttribute("UserName").toString();
      // System.out.println("session bachka maapping : "+session +" \n user
      // "+session.getAttribute("UserName").toString());

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("<script src=\"js/editCustomer_details.js\"> </script> \n");
      out.write("\n");
      out.write("<script type=\"text/javascript\" src=\"js/popup.js\"></script>\n");
      out.write("<style>\n");
      out.write("hr {\n");
      out.write("color: #f00;\n");
      out.write("background-color: #f00;\n");
      out.write("height: 3px;\n");
      out.write("}\n");
      out.write("#selected_order{\n");
      out.write("width: 40%;\n");
      out.write("max-height: 300px;\n");
      out.write("border: 1px solid black; \n");
      out.write("background-color: #ECFB99;\n");
      out.write("float: right;\n");
      out.write("margin-top: 30px;\n");
      out.write("overflow: auto;\n");
      out.write("margin-right: 2%;\n");
      out.write("padding: 5px;\n");
      out.write("}\n");
      out.write("</style>\n");
      out.write("<script>\n");
      out.write("\t\n");
      out.write("\tfunction checkField(){\n");
      out.write("\t\tif(document.myform.chckall.checked==true){\n");
      out.write("\t\t\tshowHint();\n");
      out.write("\t\t}\n");
      out.write("\t\telse{\t\tvar c_date1,c_date2,u_date2,u_date1;\n");
      out.write("\t\t\t\tif(!($(\"#createDate2\").jqxDateTimeInput('disabled'))){\n");
      out.write("\t\t\t\tc_date1 = $('#createDate1').jqxDateTimeInput('getText');\n");
      out.write("\t\t\t\tc_date2 = $('#createDate2').jqxDateTimeInput('getText');\n");
      out.write("\t\t\t}\n");
      out.write("\t\t\t\n");
      out.write("\t\t\tif(!($(\"#updateDate2\").jqxDateTimeInput('disabled'))){\n");
      out.write("\t\t\t\tu_date1 = $('#updateDate1').jqxDateTimeInput('getText');\n");
      out.write("\t\t\t\tu_date2 = $('#updateDate2').jqxDateTimeInput('getText');\n");
      out.write("\t\t\t}\t    \n");
      out.write("\t\t    showHint();\t\t  \n");
      out.write("\t    }\n");
      out.write("\t}\n");
      out.write("\tfunction showMsg(){\n");
      out.write("\t  \t document.myform.action=\"HomeForm.jsp\";\n");
      out.write("\t   \t document.myform.submit();\n");
      out.write("\t}\n");
      out.write("\tfunction Clear(){\n");
      out.write("\t\t\n");
      out.write("\t\ttry{\n");
      out.write("\t\t\tdocument.getElementById(\"order_number\").focus();\n");
      out.write("\t\t} catch (exp){}\n");
      out.write("\t\t\n");
      out.write("\t\t\n");
      out.write("\t\t\n");
      out.write("\t\tdocument.myform.custCode.value=\"\";\n");
      out.write("\t\tdocument.myform.phonenumber.value=\"\";\n");
      out.write("\t\tdocument.myform.custName.value=\"\";\n");
      out.write("\t\tdocument.myform.nameString.value=\"\";\t\t\n");
      out.write("\t\tdocument.myform.Building.value=\"\";\n");
      out.write("\t\tdocument.myform.Building_no.value=\"\";\n");
      out.write("\t\tdocument.myform.wing.value=\"\";\n");
      out.write("\t\tdocument.myform.block.value=\"\";\n");
      out.write("\t\tdocument.myform.add1.value=\"\";\n");
      out.write("\t\tdocument.myform.add2.value=\"\";\n");
      out.write("\t\tdocument.myform.area.value=\"\";\n");
      out.write("\t\tdocument.myform.station.value=\"\";\n");
      out.write("\t\t\n");
      out.write("\t\tdocument.myform.selmonth.value=\"\";\n");
      out.write("\t\t\n");
      out.write(
          "\t\t$(\"#createDate1\").jqxDateTimeInput({theme:'ui-redmond',width: '250px', height: '25px',max:new Date(),formatString: \"yyyy-MM-dd\"});\n");
      out.write(
          "\t\t$(\"#createDate2\").jqxDateTimeInput({theme:'ui-redmond',width: '250px', height: '25px',min:new Date(),max:new Date(),formatString: \"yyyy-MM-dd\",value:new Date()});\n");
      out.write("\t\t$(\"#createDate2\").jqxDateTimeInput({disabled: true});\n");
      out.write("\t\t\n");
      out.write("\t\t\n");
      out.write(
          "\t\t$(\"#updateDate1\").jqxDateTimeInput({theme:'ui-redmond',width: '250px', height: '25px',max:new Date(),formatString: \"yyyy-MM-dd\"});\n");
      out.write(
          "\t\t$(\"#updateDate2\").jqxDateTimeInput({theme:'ui-redmond',width: '250px', height: '25px',min:new Date(),max:new Date(),formatString: \"yyyy-MM-dd\",value:new Date()});\n");
      out.write("\t\t$(\"#updateDate2\").jqxDateTimeInput({disabled: true});\n");
      out.write("\t\t\n");
      out.write("\t\t$('#createDate1').on('close', function (event) {\n");
      out.write("\t\t // Some code here. \n");
      out.write("\t\t \t$(\"#createDate2\").jqxDateTimeInput({disabled: false});\n");
      out.write(
          "\t\t \t$(\"#createDate2\").jqxDateTimeInput({min: $('#createDate1').jqxDateTimeInput('getDate')});\n");
      out.write(" \t\t}); \t\n");
      out.write(" \t\t\n");
      out.write(" \t\t$('#updateDate1').on('close', function (event) {\n");
      out.write("\t\t // Some code here. \n");
      out.write("\t\t \t$(\"#updateDate2\").jqxDateTimeInput({disabled: false});\n");
      out.write(
          "\t\t \t$(\"#updateDate2\").jqxDateTimeInput({min: $('#updateDate1').jqxDateTimeInput('getDate')});\n");
      out.write(" \t\t}); \t\n");
      out.write("\t\t\n");
      out.write("\t\tfunEnabled();\n");
      out.write("\t}\n");
      out.write("\t\n");
      out.write("function ckeckEmpty(){\n");
      out.write("\tif(document.getElementById(\"order_number\").value == \"\"){\n");
      out.write("\t\talert(\"Please Enter Order Number\");\n");
      out.write("\t\tdocument.getElementById(\"order_number\").focus();\n");
      out.write("\t\treturn false;\n");
      out.write("\t} else {\n");
      out.write("\t\treturn true;\n");
      out.write("\t}\n");
      out.write("}\n");
      out.write("\n");
      out.write("\n");
      out.write("</script>\n");

      String call_type = request.getParameter("call_type");
      if (call_type == null) {
        call_type = "";
      }
      if (call_type.equals("search_payment")) {
        String m = "<< Show List";

        out.write("\n");
        out.write("\t\t\t<div id=\"selected_order\">\n");
        out.write("\t\t\t\t<b>Selected orders</b>\n");
        out.write(
            "\t\t\t\t<form action=\"PrintSelectedCustPayment.jsp\" method=\"get\" id=\"submit_form\">\n");
        out.write(
            "\t\t\t\t<table style=\"width: 100%;border-collapse: collapse;\" border=1 id=\"selected_order_table\">\n");
        out.write("\t\t\t\t<tr>\n");
        out.write("\t\t\t\t\t<th style=\"width: 20%;\">Order Number</th>\n");
        out.write("\t\t\t\t\t<th style=\"width: 35%;\">Cust Name</th>\n");
        out.write("\t\t\t\t\t<th style=\"width: 20%;\">Balance</th>\n");
        out.write("\t\t\t\t\t<th style=\"width: 25%;\">&nbsp;</th>\n");
        out.write("\t\t\t\t</tr>\n");
        out.write("\t\t\t\t</table>\n");
        out.write("\t\t\t\t<table style=\"width: 100%;\" border=1 id=\"insert_table\">\n");
        out.write("\t\t\t\t</table>\n");
        out.write(
            "\t\t\t\t <input type=\"text\" readonly=\"readonly\" name=\"order_count\" id=\"order_count_id\" size=\"3\" value=\"0\" style=\"background-color :#ECFB99 ;\"/> orders selected to print.\n");
        out.write(
            "\t\t\t\t<input type=\"submit\" onclick=\" return printSelectedInformation()\" value=\"Print\" style=\"float: right;\"/>\n");
        out.write("\t\t\t\t</form>\n");
        out.write("\t\t\t</div>\n");
        out.write("\t\t");
      }
      if (!call_type.equals("search_payment") || !call_type.equals("communication")) {

        out.write("\n");
        out.write("<center>\n");
      }
      out.write("\n");
      out.write("<fieldset style=\"width: 55%;\"><legend>\n");

      String msg = request.getParameter("msg");
      if (call_type.equals("receive_payment")) {
        out.print("<h3>Search Customer To Receive Payment</h3>");
      } else if (call_type.equals("search_payment")) {
        out.print("<h3>Search Customer To See Pending</h3>");
      } else if (call_type.equals("communication")) {
        out.print("<h3>Search Customer To Communicate</h3>");
      } else {
        out.print("<h3>Search Customer</h3>");
      }

      out.write("\n");
      out.write("</legend>\n");

      if (call_type.equals("receive_payment")) {

        out.write("\n");
        out.write(
            "\t\t<input type = \"radio\" name = \"radio\" onclick=\"ChangeCriteria('order')\" checked=\"checked\"/>Search By Order Number\n");
        out.write(
            "\t\t<input type = \"radio\" name = \"radio\" onclick=\"ChangeCriteria('cust')\"/>Search By Customer Detail\n");
        out.write("\t");
      }
      if (call_type.equals("receive_payment")) {

        out.write("\n");
        out.write("\t<br/><br/>\n");
        out.write("<form id=\"myform1\" action=\"SearchCustUsingOrderNo.jsp\" method=\"get\">\n");
        out.write("\t");

        if (msg != null) {
          out.print("<i><font color=red>No Matching Record Found</font></i><br/><br/>");
        }

        out.write("\n");
        out.write(
            "\tEnter Order Number :&nbsp;&nbsp;<input type = \"text\" name = \"order_number\" value=\"\" id =\"order_number\" onkeypress=\"return isNumberKey(event)\"/>\n");
        out.write(
            "\t<input type = \"submit\" value=\"Search\" onclick=\"return ckeckEmpty();\"/>\n");
        out.write("\n");
        out.write("<br/>\n");
        out.write("</form>\n");
        out.write("<form name=\"myform\" method=\"post\" id=\"myform\" style=\"display: none\">\n");
      } else {
        out.write("\n");
        out.write("<form name=\"myform\" method=\"post\" id=\"myform\" >\n");
      }
      out.write("\n");
      out.write("\t<table style=\"width: 100%;\">\n");
      out.write("\t\t<tr style=\"width: 100%;\">\n");
      out.write(
          "\t\t\t<td align=\"center\" colspan=3><b><font color=\"blue\">&nbspA</font>ll Customers List &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp\n");
      out.write(
          "\t\t\t<input type=\"CheckBox\" name=\"chckall\" accesskey=\"a\" onClick=\"funEnabled();\"></td>\n");
      out.write("\t\t</tr>\t\t\n");
      out.write("\t\t<tr style=\"width: 100%;\">\n");
      out.write("\t\t\t<td colspan=3>\n");
      out.write("\t\t\t<div id=\"div4\" style=\"width: 100%;\" >\n");
      out.write("\t\t\t\t<table>\t\t\t\t\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\">\n");
      out.write("\t\t\t\t\t\t\t<b><font color=\"blue\">C</font>ustomer Code</b>\n");
      out.write("\t\t\t\t\t\t</td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 29%;\"><input style=\"width: 97%;\" type=\"text\" name=\"custCode\" accesskey=\"c\"></td>\n");
      out.write("\t\t\t\t\t\t");
      if (call_type.equals("search_payment") || call_type.equals("communication")) {
        out.write("\n");
        out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
        out.write("\t\t\t\t\t\t\n");
        out.write("\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\">\n");
        out.write("\t\t\t\t\t\t\t<b>O<font color=\"blue\">r</font>der Number</b>\n");
        out.write("\t\t\t\t\t\t</td>\n");
        out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
        out.write(
            "\t\t\t\t\t\t<td style=\"width: 29%;\"><input style=\"width: 97%;\" type=\"text\" name=\"ordernumber\" accesskey=\"c\"></td>\n");
        out.write("\t\t\t\t\t\t");
      }
      out.write("\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Customer <font color=\"blue\">N</font>ame</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 29%;\"><input style=\"width: 97%;\" type=\"text\" name=\"custName\"  align=\"right\" accesskey=\"n\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b><font color=\"blue\">P</font>hone Number</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 29%;\"><input style=\"width: 97%;\" type=\"text\" name=\"phonenumber\" size=\"22\" align=\"right\" colspan=\"2\" accesskey=\"p\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>M<font color=\"blue\">o</font>bile Number</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" type=\"text\" name=\"mobilenumber\" size=\"22\" align=\"right\" colspan=\"2\" accesskey=\"o\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Na<font color=\"blue\">m</font>e String</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" style=\"width: 100%;\" type=\"text\" name=\"nameString\" size=\"22\"  align=\"right\" accesskey=\"m\" colspan=\"2\"></td>\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b><font color=\"blue\">B</font>uilding</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" type=\"text\" name=\"Building\" accesskey=\"b\" align=\"right\"></b></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Building <font color=\"blue\">N</font>o.</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" type=\"text\" name=\"Building_no\"  size=\"22\"  accesskey=\"o\"></b></td>\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t    <td style=\"width: 15%;\" align=\"left\"><b><font color=\"blue\">W</font>ing</b></td>\n");
      out.write("\t\t\t\t\t    <td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t    <td><input style=\"width: 97%;\" type =\"text\" name=\"wing\" accesskey=\"w\" ></td>\n");
      out.write("\t\t\t\t\t    \n");
      out.write("\t\t\t\t\t    <td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t    \n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b><font color=\"blue\">F</font>lat No.</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" type =\"text\" name=\"block\"  size=\"22\" accesskey=\"f\" align=\"right\">\n");
      out.write("\t\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Addr<font color=\"blue\">e</font>ss1</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" type =\"text\" accesskey=\"e\" name=\"add1\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>A<font color=\"blue\">d</font>dress2</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t\t<td><input style=\"width: 97%;\" type =\"text\" accesskey=\"d\" name=\"add2\" size=\"22\"></td>\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr >\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>A<font color=\"blue\">r</font>ea</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write("\t\t\t\t\t\t<td>\n");
      out.write("\t\t\t\t\t\t");

      String name;
      try {
        Context initContext = new InitialContext();
        Context envContext = (Context) initContext.lookup("java:/comp/env");
        // DataSource ds = (DataSource)envContext.lookup("jdbc/js");
        DataSource ds = (DataSource) envContext.lookup("jdbc/re");
        Connection conn = ds.getConnection();
        Statement stmt = conn.createStatement();
        ResultSet rs =
            stmt.executeQuery(
                "select value from code_table where category='AREA' order by value asc");

        out.write("\n");
        out.write("\t\t\t\t\t\t\t<SELECT style=\"width: 97%;\" name=\"area\">\n");
        out.write("\t\t\t\t\t\t\t\t<OPTION VALUE=\"\"> Select Area </OPTION>\n");
        out.write("\t\t\t\t\t\t");

        while (rs.next()) {
          name = rs.getString(1);

          out.write("\n");
          out.write("\t\t\t\t\t\t\t\t<OPTION VALUE=\"");
          out.print(name);
          out.write('"');
          out.write('>');
          out.write(' ');
          out.print(name);
          out.write(" </OPTION>\n");
          out.write("\t\t\t\t\t\t");
        }

        out.write("\n");
        out.write("\t\t\t\t\t\t\t</SELECT>\n");
        out.write("\t\t\t\t\t\t</td>\t\n");
        out.write("\t\t\t\t\t\t\n");
        out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
        out.write("\t\t\t\n");
        out.write(
            "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Payment Type</b></td>\n");
        out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
        out.write("\t\t\t\t\t\t<td>\n");
        out.write("\t\t\t\t\t\t\t<SELECT style=\"width: 97%;\" name=\"payment\" align=\"left\">\n");
        out.write("\t\t\t\t\t\t\t\t<OPTION selected VALUE=\"\"> Select Type </OPTION>\n");
        out.write("\t\t\t\t\t\t\t\t<OPTION VALUE=\"NoType\"> No Type </OPTION>\n");
        out.write("\t\t\t\t\t\t");

        ResultSet rs2 =
            stmt.executeQuery("SELECT payment_type_code, payment_type_desc FROM payment_type");
        while (rs2.next()) {

          out.write("\t\n");
          out.write("\t\t\t\t\t\t\t\t<OPTION VALUE=\"");
          out.print(rs2.getString(1));
          out.write('"');
          out.write('>');
          out.write(' ');
          out.print(rs2.getString(2));
          out.write(" </OPTION>\n");
          out.write("\t\t\t\t\t\t");
        }
        rs2.close();
        stmt.close();
        conn.close();
      } catch (Exception e) {
        e.getMessage();
        e.printStackTrace();
      }

      out.write("\n");
      out.write("\t\t\t\t\t\t\t</SELECT>\n");
      out.write("\t\t\t\t\t\t</td>\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Create<font color=\"blue\">D</font>ate</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write("\t\t\t\t\t\t<td>\n");
      out.write(
          "\t\t\t\t\t\t\t<!-- <input type =\"text\" accesskey=\"d\" name=\"c_date1\" size=\"15\" style=\"width: 79%;\">\n");
      out.write(
          "\t\t\t\t\t\t\t<input type=\"button\" onClick=\"c1.popup('c_date1');\" value=\"...\" style=\"width: 15%;\"/> -->\n");
      out.write("\t\t\t\t\t\t\t<div id='createDate1'></div>\n");
      out.write("\t\t\t\t\t\t</td>\n");
      out.write("\t\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>And</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write("\t\t\t\t\t\t<td> \n");
      out.write(
          "\t\t\t\t\t\t\t<!-- <input type =\"text\" name=\"c_date2\" size=\"15\" style=\"width: 79%;\">\n");
      out.write(
          "\t\t\t\t\t\t\t<input type=\"button\" onClick=\"c1.popup('c_date2');\" value=\"...\" style=\"width: 15%;\"/> -->\n");
      out.write("\t\t\t\t\t\t\t<div id='createDate2'></div>\n");
      out.write("\t\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t</td>\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b><font color=\"blue\">U</font>pdate Date</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write("\t\t\t\t\t\t<td>\n");
      out.write(
          "\t\t\t\t\t\t\t<!-- <input type =\"text\" accesskey=\"u\" name=\"u_date1\" size=\"15\" style=\"width: 79%;\"/>\n");
      out.write(
          "\t\t\t\t\t\t\t<input type=\"button\" onClick=\"c1.popup('u_date1');\" value=\"...\" style=\"width: 15%;\"/> -->\n");
      out.write("\t\t\t\t\t\t\t<div id=\"updateDate1\"></div>\n");
      out.write("\t\t\t\t\t\t</td>\n");
      out.write("\t\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>And</b></td>\n");
      out.write("\t\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write("\t\t\t\t\t\t<td> \n");
      out.write(
          "\t\t\t\t\t\t\t<!-- <input type =\"text\" name=\"u_date2\" size=\"15\" style=\"width: 79%;\"/>\n");
      out.write(
          "\t\t\t\t\t\t\t<input type=\"button\" onClick=\"c1.popup('u_date2');\" value=\"...\" style=\"width: 15%;\"/> -->\n");
      out.write("\t\t\t\t\t\t\t<div id='updateDate2'></div>\n");
      out.write("\t\t\t\t\t\t</td>\n");
      out.write("\t\t\t\t\t</tr>\n");
      out.write("\t\t\t\t\t<tr>\n");
      out.write(
          "\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b><font color=\"blue\">S</font>tation</b></td>\n");
      out.write("\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t<td><input style=\"width: 97%;\" type =\"text\"  size=\"22\" accesskey=\"d\" name=\"station\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t<td style=\"width: 8%;\" align=\"left\"></td>\n");
      out.write("\t\t\t\t\t\t\n");
      out.write("\t\t\t\t\t<td style=\"width: 15%;\" align=\"left\"><b>Last Order Days</b></td>\n");
      out.write("\t\t\t\t\t<td style=\"width: 1%;\" align=\"left\">:</td>\n");
      out.write(
          "\t\t\t\t\t<td><input style=\"width: 97%;\" type=\"text\" name=\"selmonth\"/></td></tr>\n");
      out.write("\t\t\t\t</table></div>\n");
      out.write("\t\t\t</td>\n");
      out.write("\t\t</tr>\n");
      out.write("\t\t\t\n");
      out.write("\t\t<tr>\n");
      out.write("\t\t\t<td align=\"center\" colspan=4>\n");
      out.write(
          "\t\t\t\t<input type=\"submit\" name=\"search\"  title=\"Press <Enter>\" value=\"Search <Enter>\" accesskey=\"s\" onclick=\"checkField();return false;\"/>\n");
      out.write(
          "\t\t\t\t<input type=\"reset\" name=\"clear\" title=\"Press <Alt+c>\" tabindex=\"1\" value=\"Clear <Alt+c>\" accesskey=\"c\" onclick=\"document.getElementById('txtHint').innerHTML='';\"/>\n");
      out.write(
          "\t\t\t\t<INPUT type=BUTTON value=\"Cancel <Alt+c>\" accesskey=\"c\" onClick=\"showMsg();\"/></center>\n");
      out.write("\t\t\t</td>\n");
      out.write("\t\t</tr>\n");
      out.write("\t</table>\n");
      out.write("\t</fieldset>\n");
      out.write("\t<input  type=\"hidden\" name=\"hchckall\" value=\"1\">\n");
      out.write("\t<input type=\"hidden\" name=\"call_type\" value=\"");
      out.print(call_type);
      out.write("\"/>\n");
      out.write("<script>\n");
      out.write("function funEnabled(){\n");
      out.write("\t    if (document.myform.chckall.checked==true){\n");
      out.write("\t\t\tdocument.getElementById('div4').style.visibility=\"hidden\";\n");
      out.write("\t\t\tdocument.myform.hchckall.value=1;\t\t\n");
      out.write("\t\t\t$(\"#createDate2\").jqxDateTimeInput({disabled: true});\n");
      out.write("\t\t\t$(\"#updateDate2\").jqxDateTimeInput({disabled: true});\n");
      out.write("\t\t\t\n");
      out.write("\t\t}\n");
      out.write("\t\telse{\n");
      out.write("\t\t\tdocument.getElementById('div4').style.visibility=\"visible\";\n");
      out.write("\t\t\tdocument.myform.hchckall.value=0;\t\t\t\n");
      out.write("\t\t}\n");
      out.write("\t}\n");
      out.write("window.onload =Clear;\n");
      out.write("\n");
      out.write("function ChangeCriteria(str){\n");
      out.write("\tif(str == \"cust\"){\n");
      out.write("\t\tdocument.getElementById(\"myform\").style.display='block';\n");
      out.write("\t\tdocument.getElementById(\"myform1\").style.display='none';\n");
      out.write("\t}else if(str == \"order\"){\n");
      out.write("\t\tdocument.getElementById(\"myform\").style.display='none';\n");
      out.write("\t\tdocument.getElementById(\"myform1\").style.display='block';\n");
      out.write("\t\tdocument.getElementById(\"txtHint\").innerHTML=\"\";\n");
      out.write("\t\tdocument.getElementById(\"order_number\").focus();\n");
      out.write("\t\tdocument.getElementById(\"order_number\").value=\"\";\n");
      out.write("\t}\n");
      out.write("}\n");
      out.write("function isNumberKey(evt) {\n");
      out.write("\tvar charCode = (evt.which) ? evt.which : event.keyCode;\n");
      out.write("\tif (charCode != 46 && charCode > 31 && (charCode < 48 || charCode > 57))\n");
      out.write("\t\treturn false;\n");
      out.write("\telse\n");
      out.write("\t\treturn true;\n");
      out.write("}\n");
      out.write("</script>\n");
      out.write(
          "\t<hr><center><div id=\"txtHint\" class=\"ddm1\" style=\"background-color: white;width: 100%;max-height: 400px;overflow: auto;\"></div></center>\n");
      out.write("\t<br><br>\n");
      out.write(
          "\t<p><h1><center><div id=\"waitMessage\"  style=\"cursor: sw-resize;\"></center></div></h1></p>\n");

      String fromFromName = "";
      if (request.getParameter("fromForm") != null) fromFromName = request.getParameter("fromForm");
      // CustPmtHstry

      out.write("\n");
      out.write("\t<input type=\"hidden\" name=\"fromForm\" value=\"");
      out.print(fromFromName);
      out.write("\">\n");
      out.write("</form>\n");
      out.write("\n");
      out.write(
          "<div id=\"dispdiv\" align=\"center\" style=\"border:1px solid black; padding:25px; text-align:center; display:none; background-color:#FFF; overflow:auto; height:300px; width=200px;\"> </div>\n");
      out.write("</body>\n");
      out.write("</html>\n");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.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);
        else throw new ServletException(t);
      }
    } finally {
      _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }