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

创造系统参数 (实例化参数)

2012-08-21 
创建系统参数 (实例化参数)参数文件import java.io.FileInputStreamimport java.io.FileNotFoundExceptio

创建系统参数 (实例化参数)
参数文件
import java.io.FileInputStream;import java.io.FileNotFoundException;import java.io.IOException;import java.util.Properties;public class SystemProperties {private Properties qnrSystemProperties = new Properties();private static SystemProperties context = null ;private SystemProperties() {}private void init(){initQnr();}private void initQnr() {String path = this.getClass().getResource("/").getPath()+ "qnr.properties";FileInputStream fin = null;try {fin = new FileInputStream(path);qnrSystemProperties.load(fin);fin.close();} catch (FileNotFoundException e1) {e1.printStackTrace();return;} catch (IOException e) {e.printStackTrace();return;}}public synchronized static SystemProperties getSystemPropertie(){if(context == null){context = new SystemProperties();context.init();}return context;}public String getQnrPropertyValue(String property){return qnrSystemProperties.getProperty(property);}}

引用
String updateURL = SystemProperties.getSystemPropertie()
.getQnrPropertyValue("exportURL");


热点排行