Hi,
I am trying to open a text file from
jsp page.
when the file is in the web root, then the file is open, but when i copy the file to some other directory like D drive, then its showing error: "The requested URL /servlets/oracle.jsp.JspServlet was not found on this server". This error shows that its not finding the file.
The Code i am using :
<%@page contentType="text/html" import="java.io.*" %>
<%
String path="E://REPORT//test.txt";
out.println(path);
response.setContentType("text");
response.setHeader("content-disposition","inline;filename="+path);
String temp=request.getRealPath(path);
//out.println(temp);
FileInputStream fin;
try
{
fin = new FileInputStream (temp);
out.println( new DataInputStream(fin).readLine() );
fin.close();
}
catch (IOException e)
{
out.println ("Unable to read from file" +e);
System.exit(-1);
}
%>
Thanks for your Help
Regards
[ May 10, 2007: Message edited by: sk mehrotra ]