项目中读取资源文件
2014-05-10 16:28
197 查看
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()); //存值
相关文章推荐
- javaweb项目中对于资源文件的读取
- javaweb项目中对于资源文件的读取
- javaweb项目中对于资源文件的读取
- 读取项目下 property 的资源文件工具类
- javaweb项目中对于资源文件的读取
- SSM项目-医药采购-04 国际化读取资源文件
- javaweb项目中对于资源文件的读取(to be continue)
- Java读取项目内的资源文件
- servletContext对象之读取web项目下文件资源
- 【Maven】maven项目中如何读取资源文件
- wp7读取项目生成的资源(Resource)文件
- javaweb项目中对于资源文件的读取
- 把项目中的xml文件的生成操作改为“嵌入的资源”,我在这个项目中怎么读取xml文件里的内容?
- web项目中servlet利用servletContext对象读取资源文件
- idea中maven项目xml资源文件无法读取
- java读取项目资源文件
- JSP项目从普通类中读取资源文件路径解决方案
- web项目中对于资源文件的读取
- java web项目创建读取资源文件的Messages类
- java web项目读取资源文件