首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

用Properties种读取配置文件

2012-08-29 
用Properties类读取配置文件public static String getPropertyValue(String resource, String name) {if (

用Properties类读取配置文件
    public static String getPropertyValue(String resource, String name) {
        if (resource == null || resource.length() <= 0) return "";
        if (name == null || name.length() <= 0) return "";

        Properties properties = getProperties(resource);
        if (properties == null) {
            return "";
        }

        String value = null;

        try {
            value = properties.getProperty(name);
        } catch (Exception e) {
            Debug.log(e, module);
        }
        return value == null ? "" : value.trim();
    }

热点排行