JAVA:配置文件读取器

〔config.properties〕

[CMS properties]
cmsServerName=cms
cmsTemplateDirectoryName=template

[time out:minute]
time_out=300000

[administrator setting]
administrator=SA
admingroup=ADMINROLE

[web path setting]
innerresource=/AccessControl/jsp/innerresource/

[picture path setting]
picturePath=C:/picture/
[log path setting]
logPath=c:/log1/

〔ConfigBundle.java〕

package creator.config;

import java.util.MissingResourceException;
import java.util.ResourceBundle;

/**
 *
 * <p>Title: ConfigBundle.java</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author TanBo
 * @version 1.0
 */
public class ConfigBundle{
    private static ResourceBundle bundle;

    /**
     * init()
     */
    public ConfigBundle()
    {
    }

    /**
     * @function getString
     * @param s String
     * @return String
     */
    public static String getString(String s){
        String s1 = null;
        try{
            s1 = getResourceBundle().getString(s);
        }catch(MissingResourceException missingresourceexception){
            System.out.println("ConfigBundle:getString error!"+missingresourceexception.toString());
        }
        return s1;
    }

    /**
     * @function getResourceBundle
     * @return ResourceBundle
     */
    private static ResourceBundle getResourceBundle(){
        if(bundle == null)
            bundle = ResourceBundle.getBundle("creator.config.config");
        return bundle;
    }
}

阅读更多
个人分类: J2EE in Action
上一篇JS控件:XP提示框
下一篇JAVA:附加码生成器(图片)
想对作者说点什么? 我来说一句

冰点还原精灵密码读取器

2009年06月20日 224KB 下载

没有更多推荐了,返回首页

关闭
关闭