public class Stweek {
static private String startdate = null;
static private String totalweek = null;
synchronized static public void loads(){
if(startdate == null || totalweek == null)
{
FileInputStream is = null;
Properties dbProps = new Properties();
try {
is = new FileInputStream(filepath);
dbProps.load(is);
startdate = dbProps.getProperty("startdate");
totalweek = dbProps.getProperty("totalweek");
}
catch (Exception e) {
System.err.println("不能读取属性文件. " +
"请确保db.properties在CLASSPATH指定的路径中");
}
}
}
public static String getStartdate() {
if(tartdate==null)
loads();
return startdate;
}
public static String getTotalweek() {
if(startdate==null)
loads();
return totalweek;
}
}
public class Stweek {
InputStream is = null;
Properties dbProps = null;
public Stweek() {
// TODO Auto-generated constructor stub
is = getClass().getResourceAsStream("/date.properties");
dbProps = new Properties();
try {
dbProps.load(is);
}
catch (Exception e) {
System.err.println("不能读取属性文件. " +
"请确保db.properties在CLASSPATH指定的路径中");
}
}
public String getStartdate()
{
String sd = null;
sd = dbProps.getProperty("startdate");
return sd;
}
public String getTotalweek()
{
String totalweek=null;
totalweek = dbProps.getProperty("totalweek");
return totalweek;
}
}
import java.io.InputStream;
import java.util.Properties;
public class Stweek {
static private String startdate = null;
static private String totalweek = null;
static{
loads();
}
synchronized static public void loads(){
if(startdate == null || totalweek == null)
{
InputStream is = Stweek.class.getResourceAsStream("/date.properties");
Properties dbProps = new Properties();
try {
dbProps.load(is);
startdate = dbProps.getProperty("startdate");
totalweek = dbProps.getProperty("totalweek");
}
catch (Exception e) {
System.err.println("不能读取属性文件. " +
"请确保db.properties在CLASSPATH指定的路径中");
}
}
}
public static String getStartdate() {
if(startdate==null)
loads();
return startdate;
}
public static String getTotalweek() {
if(startdate==null)
loads();
return totalweek;
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有