/*
 * Generated by the Jasper component of Apache Tomcat
 * Version: ......
 * Generated at: 2020-07-19 00:13:10 UTC
 * Note: The last modified time of this file was set to
 *       the last modified time of the source file after
 *       generation to assist with modification tracking.
 */
package org.apache.jsp;

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.jsp.*;
import java.sql.*;
import wiseoa.*;

public final class dbconfig_jsp extends org.apache.jasper.runtime.HttpJspBase
    implements org.apache.jasper.runtime.JspSourceDependent {

  private static final javax.servlet.jsp.JspFactory _jspxFactory =
          javax.servlet.jsp.JspFactory.getDefaultFactory();

  private static java.util.Map<java.lang.String,java.lang.Long> _jspx_dependants;

  private org.apache.jasper.runtime.TagHandlerPool _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody;

  private volatile javax.el.ExpressionFactory _el_expressionfactory;
  private volatile org.apache.tomcat.InstanceManager _jsp_instancemanager;

  public java.util.Map<java.lang.String,java.lang.Long> getDependants() {
    return _jspx_dependants;
  }

  public javax.el.ExpressionFactory _jsp_getExpressionFactory() {
    if (_el_expressionfactory == null) {
      synchronized (this) {
        if (_el_expressionfactory == null) {
          _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
        }
      }
    }
    return _el_expressionfactory;
  }

  public org.apache.tomcat.InstanceManager _jsp_getInstanceManager() {
    if (_jsp_instancemanager == null) {
      synchronized (this) {
        if (_jsp_instancemanager == null) {
          _jsp_instancemanager = org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(getServletConfig());
        }
      }
    }
    return _jsp_instancemanager;
  }

  public void _jspInit() {
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody = org.apache.jasper.runtime.TagHandlerPool.getTagHandlerPool(getServletConfig());
  }

  public void _jspDestroy() {
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.release();
  }

  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; charset=UTF-8");
      pageContext = _jspxFactory.getPageContext(this, request, response,
      			"", true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

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


	Object v= request.getSession().getAttribute("canDBConfig");
	String flag ="";
	if ( v!=null) flag= v.toString();
	if ( ! flag.equals("true"))
	{
		 response.sendRedirect("dbconfig_login.jsp");
		 return;
	}


   DBConfig cfg=new DBConfig(request);
   String s=cfg.config;
   
   

      out.write("\r\n");
      out.write("\r\n");
      out.write(" <html>\r\n");
      out.write("<head><meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\" />\r\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\r\n");
      out.write("<title>使用MS SQL Server数据库的配置示例</title>\r\n");
      out.write("<LINK rel=\"stylesheet\" type=\"text/css\" href=\"css/normal.css\">\r\n");
      out.write("<script   type=\"text/javascript\"  src=\"js/validator.js\"></script>\r\n");
      out.write("<script   type=\"text/javascript\"  src=\"js/jquery.js\"></script> \r\n");
      out.write("<script   type=\"text/javascript\"  src=\"js/jst.js\"></script>\r\n");
      out.write("<script   type=\"text/javascript\"  src=\"js/json.js\"></script>\r\n");
      out.write("<script   type=\"text/javascript\"  src=\"js/zrpc.js.jsp\"></script>\r\n");
      out.write("\r\n");
      out.write("<style>\r\n");
      out.write("  . inputbox  { border:1 dashed #ffa0a0;  height:28px; width:100% }\r\n");
      out.write("</style>\r\n");
      out.write("\r\n");
      out.write("</head>\r\n");
      out.write("\r\n");
      out.write("<body>\r\n");
      out.write("\r\n");
      out.write(" \r\n");
      out.write("<table   border=\"0\">\r\n");
      out.write("  <tr>\r\n");
      out.write("    <td ><img src=\"image/data_manage.jpg\"  /></td>\r\n");
      out.write("    <td  >&nbsp;<span style=\"font-size:26px\">数据源配置</span></td>\r\n");
      out.write("  </tr>\r\n");
      out.write("</table>\r\n");
      out.write("<hr size=\"1\" />\r\n");
      out.write("<form name=\"theForm\" id=\"demo\" >\r\n");
      out.write("<div id=\"result\"></div>\r\n");
      out.write("<br>\r\n");
      out.write("<input onClick=\"save();\" name=\"ok\" type=\"button\" value=\"保存\"  style=\"width:60px;height:25px\" />\r\n");
      out.write("<input onClick=\"testcon();\" name=\"test\" type=\"button\" value=\"测试连接\" />\r\n");
      out.write("<input onClick=\"window.location.href='dbconfig_list.jsp' ;\"  type=\"button\" value=\"返回列表\" />\r\n");
      out.write("</form>\r\n");
      out.write("<br>\r\n");
      out.write("\r\n");
      out.write("<script language=\"javascript\">\r\n");
      out.write("   \r\n");
      out.write(" window.onload=function()\r\n");
      out.write(" { \r\n");
      out.write("    var testdata=");
      out.print(s);
      out.write(";\r\n");
      out.write("    \r\n");
      out.write("    var result = TrimPath.processDOMTemplate(\"template/dbconfig.htm\", testdata);\r\n");
      out.write("    \r\n");
      out.write("\tdocument.getElementById('result').innerHTML=  result  ;\r\n");
      out.write(" }\r\n");
      out.write("\r\n");
      out.write("function save()\r\n");
      out.write("{\r\n");
      out.write("    var b=Validator.Validate(document.getElementById('demo'),3);\r\n");
      out.write("    if (b) saveConfig();    \r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("function saveConfig()\r\n");
      out.write("{\r\n");
      out.write("\r\n");
      out.write("\tvar p=new Object();\r\n");
      out.write("\tp.action=\"");
      if (_jspx_meth_c_005fout_005f0(_jspx_page_context))
        return;
      out.write("\"; \r\n");
      out.write("    p.alias= document.getElementById('alias').value;\r\n");
      out.write("    p.driver_url=document.getElementById('driver_url').value;\r\n");
      out.write("    p.description= document.getElementById('description').value;\r\n");
      out.write("    p.driver_class= document.getElementById('driver_class').value;\r\n");
      out.write("    p.maximum_connection_count= document.getElementById('maximum_connection_count').value;\r\n");
      out.write("    p.minimum_connection_count= document.getElementById('minimum_connection_count').value;\r\n");
      out.write("    p.maximum_active_time= document.getElementById('maximum_active_time').value;\r\n");
      out.write("    p.maximum_connection_lifetime= document.getElementById('maximum_connection_lifetime').value;\r\n");
      out.write("    p.house_keeping_test_sql= document.getElementById('house_keeping_test_sql').value;\r\n");
      out.write("    p.test_before_use = document.getElementById('test_before_use').value;\r\n");
      out.write("    p.database_charset = document.getElementById('database_charset').value;\r\n");
      out.write("    p.client_charset = document.getElementById('client_charset').value;\r\n");
      out.write("    \r\n");
      out.write("    \r\n");
      out.write("    var p1=new Object();\r\n");
      out.write("    p1.user=document.getElementById('username').value;\r\n");
      out.write("    p1.password=document.getElementById('password').value;\r\n");
      out.write("    p.driver_properties=p1;\r\n");
      out.write("    \r\n");
      out.write("     var t= JSON.toString (  p );\r\n");
      out.write("     \r\n");
      out.write("     var ret =    $rpc( \"wiseoa.DBConfig\",  \"save\" ,  t   );\r\n");
      out.write("     if ( ret.success )\r\n");
      out.write("     {\r\n");
      out.write("        alert (\"保存成功\");\r\n");
      out.write("     }else\r\n");
      out.write("     {\r\n");
      out.write("        alert( ret.message);\r\n");
      out.write("     }\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("function testcon()\r\n");
      out.write("{\r\n");
      out.write("\r\n");
      out.write("\tvar p=new Object();\r\n");
      out.write("\r\n");
      out.write("    p.driver_url=document.getElementById('driver_url').value;\r\n");
      out.write("\r\n");
      out.write("    p.driver_class= document.getElementById('driver_class').value;\r\n");
      out.write(" \r\n");
      out.write("    p.user=document.getElementById('username').value;\r\n");
      out.write("    p.password=document.getElementById('password').value;\r\n");
      out.write("\r\n");
      out.write("    var  t= JSON.toString (  p );\r\n");
      out.write("     \r\n");
      out.write("     var ret =    $rpc( \"wiseoa.DBConfig\",  \"testconfig\" ,  t   );\r\n");
      out.write("     if ( ret.success )\r\n");
      out.write("     {\r\n");
      out.write("        alert (\"连接成功\");\r\n");
      out.write("     }else\r\n");
      out.write("     {\r\n");
      out.write("        alert( ret.message);\r\n");
      out.write("     }\r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("function gettestsql()\r\n");
      out.write("{\r\n");
      out.write("\tvar a=document.getElementById(\"driver_class\").value;\r\n");
      out.write("\tvar b=\"\";\r\n");
      out.write("\tvar c=\"\";\r\n");
      out.write("\tvar  en=true;\r\n");
      out.write("\tswitch (a) {\r\n");
      out.write("\t\tcase \"net.sourceforge.jtds.jdbc.Driver\":\r\n");
      out.write("\t\t\t\t\tc=\"jdbc:jtds:sqlserver://服务器名或IP地址/数据库名;TDS=8.0;instance=实例名\";\r\n");
      out.write("\t\t\t\t\tb=\"select getdate() \";break;\r\n");
      out.write("\t\tcase \"oracle.jdbc.driver.OracleDriver\":\r\n");
      out.write("\t\t\t\t\tc=\"jdbc:oracle:thin:@服务器名或IP地址:1521:实例名\";\r\n");
      out.write("\t\t\t\t\tb=\"select sysdate from dual\";break;\r\n");
      out.write("\t\tcase \"com.sybase.jdbc3.jdbc.SybDataSource\":\r\n");
      out.write("\t\t\t\t\tc=\"jdbc:sybase:Tds:服务器名或IP地址:5000/数据库名?CHARSET=cp936\";\r\n");
      out.write("\t\t\t\t\tb=\"select getdate() \";break;\r\n");
      out.write("\t\tcase \"org.postgresql.Driver\":\r\n");
      out.write("\t\t\t\t\tc=\"jdbc:postgresql://服务器名:5432/数据库名\";\r\n");
      out.write("\t\t\t\t\tb=\"select  current_date\";break;\r\n");
      out.write("\r\n");
      out.write("\t\tcase \"com.mysql.jdbc.Driver\":\r\n");
      out.write("\t\t\t\t\tc=\"jdbc:mysql://服务器名或IP地址:3306/数据库名?useSSL=false\";\r\n");
      out.write("\t\t\t\t\tb=\"select  sysdate() \";break;\r\n");
      out.write("\r\n");
      out.write("\t\tcase \"sun.jdbc.odbc.JdbcOdbcDriver\":\r\n");
      out.write("\t\t\t\t c=\"jdbc:odbc:driver={Microsoft Access Driver (*.mdb)};DBQ=c:/test.mdb\";\r\n");
      out.write("\t\t\t\t b=\"select date()\";\r\n");
      out.write("\t\t\t\t break;\r\n");
      out.write("\t\t\t\t\t\r\n");
      out.write("\t\tcase \"org.h2.Driver\":\r\n");
      out.write("\t\t\t　\r\n");
      out.write("\t\t\tc=\"jdbc:h2:tcp://localhost/");
      out.print(IM.server.AppRunner.h2dbPath);
      out.write("wiseoa;MVCC=TRUE\";\r\n");
      out.write("\t\t\tb=\"select  current_date\";\r\n");
      out.write("\t\t\ten=false;\r\n");
      out.write("\t\t\tbreak;\r\n");
      out.write("\t\t\t\t\r\n");
      out.write("\t\tdefault:\r\n");
      out.write("\t\t\t\t\tb=\"\";\r\n");
      out.write("\t\t}\t\t\t\r\n");
      out.write("\tdocument.getElementById(\"driver_url\").innerText=c;\r\n");
      out.write("\tdocument.getElementById(\"driver_url\").disabled=!en;\r\n");
      out.write("\t\t\r\n");
      out.write("\tdocument.getElementById(\"house_keeping_test_sql\").value=b;\r\n");
      out.write("\t \r\n");
      out.write("\t \r\n");
      out.write("}\r\n");
      out.write("\r\n");
      out.write("  </script>\r\n");
      out.write("</body>\r\n");
      out.write("</html>\r\n");
    } catch (java.lang.Throwable t) {
      if (!(t instanceof javax.servlet.jsp.SkipPageException)){
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0)
          try {
            if (response.isCommitted()) {
              out.flush();
            } else {
              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);
    }
  }

  private boolean _jspx_meth_c_005fout_005f0(javax.servlet.jsp.PageContext _jspx_page_context)
          throws java.lang.Throwable {
    javax.servlet.jsp.PageContext pageContext = _jspx_page_context;
    javax.servlet.jsp.JspWriter out = _jspx_page_context.getOut();
    //  c:out
    org.apache.taglibs.standard.tag.rt.core.OutTag _jspx_th_c_005fout_005f0 = (org.apache.taglibs.standard.tag.rt.core.OutTag) _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.get(org.apache.taglibs.standard.tag.rt.core.OutTag.class);
    _jspx_th_c_005fout_005f0.setPageContext(_jspx_page_context);
    _jspx_th_c_005fout_005f0.setParent(null);
    // /dbconfig.jsp(80,11) name = value type = null reqTime = true required = true fragment = false deferredValue = false expectedTypeName = null deferredMethod = false methodSignature = null
    _jspx_th_c_005fout_005f0.setValue((java.lang.Object) org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate("${param.action}", java.lang.Object.class, (javax.servlet.jsp.PageContext)_jspx_page_context, null, false));
    int _jspx_eval_c_005fout_005f0 = _jspx_th_c_005fout_005f0.doStartTag();
    if (_jspx_th_c_005fout_005f0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) {
      _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f0);
      return true;
    }
    _005fjspx_005ftagPool_005fc_005fout_0026_005fvalue_005fnobody.reuse(_jspx_th_c_005fout_005f0);
    return false;
  }
}
