站内搜索: 请输入搜索关键词

当前页面: 开发资料首页Eclipse 专题我这个配置文件properties,有10个参数,为什么有的参数居然在NEXT节点下?(解决就给分)

我这个配置文件properties,有10个参数,为什么有的参数居然在NEXT节点下?(解决就给分)

摘要: 我这个配置文件properties,有10个参数,为什么有的参数居然在NEXT节点下?(解决就给分)


在配置文件properties里,我是这样配置:
OAPort=13528
OASSLPort=3529
addr=10.254.201.6
port=6100
areaId=22
systemId=11
recordId=
systemdate=
operatorId=zhourunfa
password=1234567

在Ejb里面读取:
InputStream is = this.getClass().getResourceAsStream("/kate.properties");
Properties properties = new Properties();
try {
properties.load(is);
is.close();
addr = properties.getProperty("addr");
port = Integer.parseInt(properties.getProperty("port"));
areaId = Integer.parseInt(properties.getProperty("areaId"));
systemId = Integer.parseInt(properties.getProperty("systemId"));
recordId = properties.getProperty("recordId");
systemdate = properties.getProperty("systemdate");
operatorId = properties.getProperty("operatorId");
password = properties.getProperty("password");

}
catch(IOException ex) {
System.out.print(ex);
}

debug 的时候,跟踪出来properties 的属性是:
{OAPort=13528, port=6100, recordId=, operatorId=zhourunfa, addr=10.254.201.6, systemdate=, systemId=11, password=1234567, areaId=22, OASSLPort=3529}


但是我看了一下properties 的table,count是10个,但是areaId、OASSLPort等好几个居然都在NEXT节点下,于是运行到areaId = Integer.parseInt(properties.getProperty("areaId")); ,就读取不到,报错了。这是为啥啊,请高手指点一下,谢谢啊!



看上去没有问题,帮顶


谢谢帮顶,继续求救!


看看你的配置文件properties中
areaId=22后面应该有多余的空格,给去掉就好了。


↑返回目录
前一篇: 关于"未发现数据源名称并且未指定默认驱动程序"问题
后一篇: 帮我比较下哪个插件比较好?