/**
* 读取配置文件属性
*
* @author HeCheng
* @time 2010-11-20 09:56:31
*/
public static String getWSProperties(String fileName, String key) {
PropertiesManage rp = new PropertiesManage();
Properties prop = rp.loadProperties("/WEB-INF/" + fileName
+ ".properties");
return prop.getProperty(key);
}
/**
* 装载properties文件
*
* @author HeCheng
* @time 2010-11-20 09:55:40
*/
protected Properties loadProperties(String path) {
Properties prop = new Properties();
try {
// 读取path处的配置文件
File f = new File(ServletActionContext.getServletContext()
.getRealPath(path));
FileInputStream fis = new FileInputStream(f);
// 装载文件流至属性文件
prop.load(fis);
// 关闭流
fis.close();
} catch (Exception e) {
e.printStackTrace();
}
return prop;
}