jsp+servlet

阅读更多
获得 .properties配置资源的方法
public void getpoperties(){
Properties prop = new Properties();
InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream("db.prooperties");

try{
prop.load(is);
this.driver = prop.getProperty("driver");
this.dburl = prop.getProperty("dburl");
this.dbuser = prop.getProperty("dbuser");
this.password = prop.getProperty("password");
}catch(IOException e){
e.printStackTrace();
}
}

你可能感兴趣的:(jsp,servlet)