write html into file using java dynamically

Solutions on MaxInterview for write html into file using java dynamically by the best coders in the world

showing results for - "write html into file using java dynamically"
Camilo
19 Sep 2016
1import java.awt.Desktop;
2import java.io.*;
3
4class ShowGeneratedHtml {
5
6    public static void main(String[] args) throws Exception {
7        File f = new File("source.htm");
8        BufferedWriter bw = new BufferedWriter(new FileWriter(f));
9        bw.write("<html><body><h1>Blah, Blah!</h1>");
10        bw.write("<textarea cols=75 rows=10>");
11        for (int ii=0; ii<20; ii++) {
12            bw.write("Blah blah..");
13        }
14        bw.write("</textarea>");
15        bw.write("</body></html>");
16        bw.close();
17
18        Desktop.getDesktop().browse(f.toURI());
19    }
20}