网站首页 新闻首页 网页设计图形动画软件编程网站开发办公软件操作系统数据库网络技术认证考试范文资料黑客攻防 书籍教程 进入论坛

JAVA:配置文件读取器

http://www.diybl.com/ 2007-2-6  网络 点击:  [ 评论 ]
文章搜索:    【点击打包该文章】

〔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;
}
}



文章整理:DIY部落 http://www.diybl.com (本站)   【点击打包该文章】
如果图片或页面不能正常显示请点击这里 站内搜索:   

文章评论

请您留言