Properties props=new Properties();
props.load(this.getClass().getResourceAsStream("newProduct.properties")); //是读取当前类所在位置一起的db.properties文件
//props.load(new FileInputStream("db.properties")); 是读取当前目录的db.properties文件
/* ResourceBundle res = ResourceBundle.getBundle("yy.properties");
String name = res.getString("yyyy");//yy.properties应放在/WEB-INF/classes目录
*/
String date = props.getProperty("lookDate"); //取值
props.put("lookDate", new Date()); //存值
props.load(this.getClass().getResourceAsStream("newProduct.properties")); //是读取当前类所在位置一起的db.properties文件
//props.load(new FileInputStream("db.properties")); 是读取当前目录的db.properties文件
/* ResourceBundle res = ResourceBundle.getBundle("yy.properties");
String name = res.getString("yyyy");//yy.properties应放在/WEB-INF/classes目录
*/
String date = props.getProperty("lookDate"); //取值
props.put("lookDate", new Date()); //存值
228

被折叠的 条评论
为什么被折叠?



