Read file : File Save Load « JSP « Java Tutorial

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

        <H1>The Guest Book</H1>
        Here are the current entries in the file: 
            String file = application.getRealPath("/") + "basic.jsp";
            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));


23.51.File Save Load
23.51.1.Save Form Input to File using JSP
23.51.2.Index of Files
23.51.3.Read file
23.51.4.Writing Binary Data
23.51.5.Reading Binary Data