JSP FileReader与bufferedReader的使用
<%
String fileName = application.getRealPath(request.getRequestURI());
String fileResPath = new File(new File(fileName).getParent()).getParent();
File f = new File(fileResPath, "/file/MyPromise.txt");
out.print(f.getAbsolutePath());
FileReader in = new FileReader(f);
BufferedReader buffer = new BufferedReader(in);
String s = null;
while((s=buffer.readLine())!=null)
{
out.print(s);
}
buffer.close();
out.print(fileResPath);
%>