Bonjour,

J'aimerai afficher le contenu d'un fichier texte dans une division (paragraphe) de ma page JSF.

Ci joint le code, mais j'ai l'exception suivante : (Result too large)

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
public String readFile(String path) throws FileNotFoundException, IOException {
        String res="";
        FileInputStream fstream = new FileInputStream(path);
        DataInputStream in = new DataInputStream(fstream);
        BufferedReader br = new BufferedReader(new InputStreamReader(in));
        String strLine;
        while ((strLine = br.readLine()) != null) {
            res+=strLine+" ";
        }
        in.close();
        return res;
    }