WEB开发网
开发学院WEB开发Jsp 从配置文件读取信息 阅读

从配置文件读取信息

 2008-01-05 19:29:51 来源:WEB开发网   
核心提示: PRivate void loadPerpro() { Properties props = new Properties(); try { String sysPath = System.getProperty("user.dir"); System.out.println(&qu

  PRivate void loadPerpro() {
   Properties props = new Properties();
    try {
    
     String sysPath = System.getProperty("user.dir");
     System.out.println("application path : " + sysPath);
     FileInputStream fis = new FileInputStream(new File(sysPath+"/datatoldapsyn.perproties"));
     props.load(fis);
     this.strConnectString=(String)props.getProperty("dbConnectString");
     this.strUser = (String)props.getProperty("dbUser");
     this.strPwd = (String)props.getProperty("dbPwd");
     this.ldapHost = (String)props.getProperty("ldapHost");
     this.ldapOrg = (String)props.getProperty("ldapOrg");
     this.ldapDN = (String)props.getProperty("ldapDN");
     this.ldapPWD = (String)props.getProperty("ldapPWD");
    }
    catch (FileNotFoundException ex) {
     ex.printStackTrace();
    }
    catch (IOException ex1) {
     ex1.printStackTrace();
    }

  }


Tags:配置 文件 读取

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接