init.java

来自「浪子学习的留言本  主要功能就是记录留言」· Java 代码 · 共 62 行

JAVA
62
字号
package guestbook;import java.io.*;import java.util.Properties;public class Init {  private String superName=null;  private String superPassword=null;  private String driverName=null;  private String DBURL=null;  private String DBUser=null;  private String DBPassword=null;  private int pageView;  public Init(String webPath) {    Properties prop=new Properties();    try{      File file=new File(webPath+"WEB-INF"+System.getProperty("file.separator")+"guestbook.properties");      if(file.exists()){        FileInputStream fileIn=new FileInputStream(file);        prop.load(fileIn);        superName=prop.getProperty("superName");        superPassword=prop.getProperty("superPassword");        driverName=prop.getProperty("driverName");        DBURL=prop.getProperty("DBURL");        DBUser=prop.getProperty("DBUser");        DBPassword=prop.getProperty("DBPassword");        pageView=Integer.parseInt(prop.getProperty("pageView"));      }      else{        throw new FileNotFoundException("属性文件未找到");      }    }    catch(IOException e){        throw new RuntimeException(e);    }    catch(NumberFormatException e){      throw new RuntimeException(e);    }  }  public String getSuperName(){    return superName;  }  public String getSuperPassword(){    return superPassword;  }  public String getDriverName(){    return driverName;  }  public String getDBURL(){    return DBURL;  }  public String getDBUser(){    return DBUser;  }  public String getDBPassword(){    return DBPassword;  }  public int getPageView(){    return pageView;  }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?