Discussions

Web tier: servlets, JSP, Web frameworks: saving code of a file in a String

  1. saving code of a file in a String (1 messages)

    Hello!

    i need to store the source code of one jsp file in a String object. What can i do??
  2. saving code of a file in a String[ Go to top ]

    There are other ways to do it, but this will work

    String ouput = new String();

    //The path where the JSP file is located
    String path = "abc.jsp";
     FileReader fReader = new FileReader(path);
     BufferedReader bf = new BufferedReader(fReader);

      while(output != null)
               {
                 output = bf.readLine();
               }
    System.out.println(output);

    Bye
    Asad