我想把一些配置文件放在WEB-INF目录下,这样可以和class文件分开,利于管理,但不知道该怎样访问,请高手支招
解决方案 »
- struts2 文件上传问题
- wap网页抓取
- 以下是php代码 谁能换成java的 谢谢
- org.jfree.chart.ChartFactory.createTimeSeriesChart TimeSeries 乱码求指教
- JBOSS环境配置问题,请教
- applet+servlet通信的简单测试,出现http 500错误,苦恼多日无解,现向各位朋友请教。
- 帮忙写个正则
- 弱弱地问jsp基本问题
- 很奇怪的问题!不知道有没有人知道!(搜索了旧贴没有得到答案啊)
- 我想要一个JSP+BEAN+MYSQL的分页程序!
- 一个很奇怪的问题:关于struts自定义标签
- 更新记录时报错:javax.servlet.ServletException: ORA-00911: 无效字符
import java.io.*;public class Test1 {public String getPara(String fileName) {
Properties prop= new Properties();
try {
InputStream is = getClass().getResourceAsStream(fileName);
prop.load(is);
if(is!=null) is.close();
}
catch(Exception e) {
System.out.println(e+"file "+fileName+" not found");
}
return prop.getProperty("file_name");
}
public static void main(String[] args) {
Test1 test = new Test1();
System.out.println(test.getPara("db.property"));
}
}
java.lang.NullPointerExceptionfile log4j_init.properties not found
null