📄 init.java
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -