Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

how to display a text file in a html page?

843841Apr 7 2003 — edited Apr 8 2003
I have written a servlet that executes a batch file whose output is saved to a txt file. I am attempting to display content of the text file as a html page from the servlet but am struggling I have attempted to read the file and output it as shown below but it is not displaying the correct data

Appreciate some help

Thanks in advance

Amjad

Runtime r = Runtime.getRuntime();
Process p = r.exec("C:\\Condor\\test\\QueStatus.bat");

PrintWriter out;
String title = "Que Status";
response.setContentType("text/html");
out = response.getWriter();

FileReader fr = new FileReader ("C:\\Condor\\test\\output.txt");
for (int chr = fr.read(); chr != -1; chr = fr.read()){
out.print(chr);
}
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 6 2003
Added on Apr 7 2003
4 comments
394 views