/***************************************************************************
* 得到指定properties文件中的对应属性的值
*
* @param propertiesName
* 文件名称
* @param paramname
* 属性名称
* @return paramvalue 返回对应属性值
*
**************************************************************************/
public String getPropert(String propertiesName, String paramname) {
InputStream in = this.getClass().getClassLoader().getResourceAsStream(
propertiesName);
Properties prop = new Properties();
String paramvalue = null;
try {
prop.load(in);
paramvalue = prop.getProperty(paramname).trim();
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
in.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return paramvalue;
}
this.getClass().getClassLoader().getResourceAsStream(""); 是得到src根目录的路径 发布后默认为WEB-INF\classes目录