1 WEB-INF路径
2 String path = WsTestBOImpl.class.getClass().getResource("/").getPath();
3 path = path.substring(1, path.indexOf("classes"));
4
5 web-inf 下面的classses路径(也就是src路径)
6 String path = WsTestBOImpl.class.getClass().getResource("/").getPath();
7 path = path.substring(1, path.length());
8
9 --获取.properties配置文件的值--
10 Properties p = new Properties();
11 p.load(new FileInputStream(path + "aaa.properties"));
12 String s = p.getProperty("name");
http://blog.csdn.net/fancylovejava/article/details/7577294