コード例 #1
0
 String dLookUp(java.sql.Statement stat, String table, String fName, String where) {
   java.sql.Connection conn1 = null;
   java.sql.Statement stat1 = null;
   try {
     conn1 = cn();
     stat1 = conn1.createStatement();
     java.sql.ResultSet rsLookUp =
         openrs(stat1, "SELECT " + fName + " FROM " + table + " WHERE " + where);
     if (!rsLookUp.next()) {
       rsLookUp.close();
       stat1.close();
       conn1.close();
       return "";
     }
     String res = rsLookUp.getString(1);
     rsLookUp.close();
     stat1.close();
     conn1.close();
     return (res == null ? "" : res);
   } catch (Exception e) {
     return "";
   }
 }
コード例 #2
0
  String getOptions(
      java.sql.Connection conn,
      String sql,
      boolean isSearch,
      boolean isRequired,
      String selectedValue) {

    String sOptions = "";
    String sSel = "";

    if (isSearch) {
      sOptions += "<option value=\"\">All</option>";
    } else {
      if (!isRequired) {
        sOptions += "<option value=\"\"></option>";
      }
    }
    try {
      java.sql.Statement stat = conn.createStatement();
      java.sql.ResultSet rs = null;
      rs = openrs(stat, sql);
      while (rs.next()) {
        String id = toHTML(rs.getString(1));
        String val = toHTML(rs.getString(2));
        if (id.compareTo(selectedValue) == 0) {
          sSel = "SELECTED";
        } else {
          sSel = "";
        }
        sOptions += "<option value=\"" + id + "\" " + sSel + ">" + val + "</option>";
      }
      rs.close();
      stat.close();
    } catch (Exception e) {
    }
    return sOptions;
  }
コード例 #3
0
  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('\n');
      out.write('\n');
      out.write('\n');

      String cSec = checkSecurity(2, session, response, request);
      if ("sendRedirect".equals(cSec)) return;

      boolean bDebug = false;

      String sAction = getParam(request, "FormAction");
      String sForm = getParam(request, "FormName");
      String seditorialsErr = "";

      java.sql.Connection conn = null;
      java.sql.Statement stat = null;
      String sErr = loadDriver();
      conn = cn();
      stat = conn.createStatement();
      if (!sErr.equals("")) {
        try {
          out.println(sErr);
        } catch (Exception e) {
        }
      }

      out.write('\n');
      out.write(
          "\n\n<html>\n<head>\n<title>Book Store</title>\n<meta name=\"GENERATOR\"\n\tcontent=\"YesSoftware CodeCharge v.1.2.0 / JSP.ccp build 05/21/2001\" />\n<meta http-equiv=\"pragma\" content=\"no-cache\" />\n<meta http-equiv=\"expires\" content=\"0\" />\n<meta http-equiv=\"cache-control\" content=\"no-cache\" />\n<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n</head>\n<body\n\tstyle=\"background-color: #FFFFFF; color: #000000; font-family: Arial, Tahoma, Verdana, Helveticabackground-color: #FFFFFF; color: #000000; font-family: Arial, Tahoma, Verdana, Helvetica\">\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "Header.jsp", out, true);
      out.write("\n<table>\n\t<tr>\n\n\t\t<td valign=\"top\">\n\t\t");
      editorials_Show(request, response, session, out, seditorialsErr, sForm, sAction, conn, stat);
      out.write("\n\n\t\t</td>\n\t</tr>\n</table>\n\n");
      org.apache.jasper.runtime.JspRuntimeLibrary.include(
          request, response, "Footer.jsp", out, true);
      out.write(
          "\n<center><font face=\"Arial\"><small>This dynamic\nsite was generated with <a href=\"http://www.codecharge.com\">CodeCharge</a></small></font></center>\n</body>\n</html>\n");

      out.write('\n');

      if (stat != null) stat.close();
      if (conn != null) conn.close();

      out.write('\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);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }