首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

读取pageconfig属性的步骤

2012-09-14 
读取pageconfig属性的方法int date Integer.parseInt(ReadProperties.getString(reserve_date))?----

读取pageconfig属性的方法

int date = Integer.parseInt(ReadProperties.getString("reserve_date"));

?

---------------------------------------------ReadProperties.java--------------------------------------------------------------------------------

/*
?* 读取pageconfig.resources文件夹中的属性文件
??*/
public class ReadProperties {
??private static final ResourceBundle bundle;
?static{
??bundle = ResourceBundle.getBundle("resources.pageconfig");//资源文件名
?}
?
?/**
? * 根据name获得字符串的名
?? */
?public static String getString(String name) {
??String value = null;
??try {
???value = bundle.getString(name);
???value = new String(value.getBytes("ISO8859-1"),"GBK");
??}
??catch (MissingResourceException e) {
???System.err.println(e);
??}
??catch(Exception ee){
???System.err.println(ee);
??}
??if ("".equals(value)) {
???return null;
??}
??else {
???return value;
??}
?}
?
?/**
? * 根据名称获得icon的图片,文件的路径信息配置在文件中
? * @author:hehao
? * @param name
? * @return
? */
?public static Icon getIcon(String name) {
??String value = getString(name);
??if (value != null) {
???return new LazyImageIcon(getResource(value));
??}
??return null;
?}
?
?/**
? * 根据icon图片名称获得图片
? * @author:hehao
? * @param name
? * @return
? */
?public static Icon getResourceIcon(String name){
??return new LazyImageIcon(getResource(name));
?}
?
?/**
? * 根据名称获得URL对象
? * @author:hehao
? * @param name
? * @return
? */
?public static URL getResource(String name) {
??URL url = ReadProperties.class.getResource(name);
??return url;
?}
}
--------------------------------------------------------------------------------------------------------------------

一下是资源文件

--------------------------------------------------pageconfig.properties--------------------------------------------------------------------------
bsp_server_ip=127.0.0.1

bsp_post=12000

bsp_server_port=10000

rsp_server_url=http://127.0.0.1:8080/******/

//rsp_server_url=http://127.0.0.1:8080/***

yh_server_port=11000

rsp_train_holddate=2

website_url=http://*********/web/*******/index.htm

reserve_date=3
rsp_reserve_date=2
rsp_apply_holddate=20


paiduiji_ftp_url=10.100.254.99
paiduiji_zxpdj_ftp_path=/weblogic/workflow/logs/xtw/
paiduiji_zhuser2_ftp_path=/weblogic/workflow/logs/xtw/
paiduiji_jhuser2_ftp_path=/weblogic/workflow/logs/xtw/
paiduiji_cmuser2_ftp_path=/weblogic/workflow/logs/xtw/
paiduiji_ftp_user=weblogic
paiduiji_ftp_password=weblogic
paiduiji_ftp_port=21

热点排行