try{
String url = this.getClass().getResource("").getPath().replaceAll("%20", " ");
String path = url.substring(0, url.indexOf("WEB-INF")) + "WEB-INF/config.properties";
Properties config = new Properties();
config.load(new FileInputStream(path));
System.out.println(config.getProperty("dbDriver"));
} catch (Exception e){
e.printStackTrace();
}
转自:[url]http://www.blogjava.net/xiaosilent/archive/2006/12/22/89575.html[/url]