JSP中怎么读取配置文件
展开全部
public static void main(String[] args) {
Properties pro = new Properties();
try {
pro.load(new FileInputStream((c:/jdbc.properties")));
} catch (FileNotFoundException e) {
System.out.println("1-FileNotFoundException");
e.printStackTrace();
} catch (IOException e) {
System.out.println("2-IOException");
e.printStackTrace();
}
db_driver = pro.getProperty("db_driver");
db_url = pro.getProperty("db_url");
db_userName = pro.getProperty("db_userName");
db_passWord = pro.getProperty("db_passWord");
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询