File: The Guest Book : File Reader « JSP « Java

File: The Guest Book

<%@ page import="*" %>
        <TITLE>The Guest Book</TITLE>

        <H1>The Guest Book</H1>
        Here are the current entries in the guest book: 
            String file = application.getRealPath("/") + "test.txt";
            File fileObject = new File(file);

            char data[] = new char[(int) fileObject.length()];
            FileReader filereader = new FileReader(file);

            int charsread =;
            out.println(new String(data, 0 , charsread));



Related examples in the same category

1.Jsp Page Reading File