private void loadPerpro() { Properties props = new Properties(); try { String sysPath = System.getProperty("user.dir"); System.out.printl" name="description" />

从配置文件读取信息

发表于:2007-06-22来源:作者:点击数: 标签:
MI LY: 黑体; mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial"> private void loadPerpro() { Properties props = new Properties(); try { String sysPath = System.getProperty("user.dir"); System.out.printl

   

MILY: 黑体; mso-bidi-font-size: 10.0pt; mso-ascii-font-family: Arial; mso-hansi-font-family: Arial">  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();
      }

  }

原文转自:http://www.ltesting.net