Read Text File (.txt) Using JSP / Java

<%
BufferedReader input = new BufferedReader(new FileReader("text2read.txt"));
String line = "";
while ((line = input.readLine()) != null) {
out.println(line);
}
output.flush();
input.close();
%>

Source: http://experts.about.com/q/JSP-Java-Server…xt-file-JSP.htm
Additional example http://www.jguru.com/forums/view.jsp?EID=536740

Leave a Reply

Your email address will not be published. Required fields are marked *