• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

FILE NOT READING IS JSP

 
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
THE .TXT FILES I WANNA READ R NOT BEING READ
CODE IS UP HERE.


[This message has been edited by Jim Yingst (edited February 21, 2001).]
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There was some strange garbled stuff mixed in with your code; I cleaned it up for you. I hope I didn't take out anything that was supposed to be there. Anyway, it looks like the most likely problem is that in your while loop, you use readLine() twice but only check for a null once. You probably want to fix this to read only one line each time through the loop, check if that line is null, and then do something with that line (without reading another line - save that for the next time through the loop).
Also, in your catch IOException, you will get much better information if something does go wrong if you put in something like:
<code><pre> System.out.println("Error reading file: " + e.getMessage());</pre></code>
or even
<code><pre> e.printStackTrace();</pre></code>

[This message has been edited by Jim Yingst (edited February 21, 2001).]
 
Ranch Hand
Posts: 1953
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In JSP, sometimes it could not find your file, you have to get path URI first, then do file reading/writing.
String path = application.getRealPath("/WEB-INF/");
However, I did not have this problem on local drive. To which, Jim probably solved your problem.
Thanks!
Roseanne
Join our SCJD Study Group when certified
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic