How to create HTML file using Java

http://www.riskmanagementconsulting.ca/paradays/1069 you could check here How to create HTML file using Java

read what he said In Java, using StringBuilder, we can build HTML String and write it to a html file. This article explains how to write a html file in Java. We create a html file named “testfile.html” with the following content. 

exemple de phrase d'accroche pour site de rencontre

http://www.catalunyacamina.org/?filtraciya=citas-en-linea-clinica-de-coronado&872=d6 Write the following code in the “CreateHtmlDocument.java” class.

https://dunkl.co.at/deposti/10815 package testingbar; import java.io.*; public class CreateHtmlDocument { public static void main(String[] args) { try { //define a HTML String Builder StringBuilder htmlStringBuilder=new StringBuilder(); //append html header and title htmlStringBuilder.append("<html><head><title>Selenium Test </title></head>"); //append body htmlStringBuilder.append("<body>"); //append table htmlStringBuilder.append("<table border=\"1\" bordercolor=\"#000000\">"); //append row htmlStringBuilder.append("<tr><td><b>TestId</b></td><td><b>TestName</b></td><td><b>TestResult</b></td></tr>"); //append row htmlStringBuilder.append("<tr><td>001</td><td>Login</td><td>Passed</td></tr>"); //append row htmlStringBuilder.append("<tr><td>002</td><td>Logout</td><td>Passed</td></tr>"); //close html file htmlStringBuilder.append("</table></body></html>"); //write html string content to a file WriteToFile(htmlStringBuilder.toString(),"testfile.html"); } catch (IOException e) { e.printStackTrace(); } } public static void WriteToFile(String fileContent, String fileName) throws IOException { String projectPath = System.getProperty("user.dir"); String tempFile = projectPath + File.separator+fileName; File file = new File(tempFile); // if file does exists, then delete and create a new file if (file.exists()) { try { File newFileName = new File(projectPath + File.separator+ "backup_"+fileName); file.renameTo(newFileName); file.createNewFile(); } catch (IOException e) { e.printStackTrace(); } } //write to file with OutputStreamWriter OutputStream outputStream = new FileOutputStream(file.getAbsoluteFile()); Writer writer=new OutputStreamWriter(outputStream); writer.write(fileContent); writer.close(); } }

rencontrer un homme a 30 ans Run the code above, open the html file “testfile.html”. You will see the content below

http://netix.pl/includes/frazaty/1483

http://godswayradio.com/?rtyt=agence-de-rencontre-rom%D0%93%C2%A9o-et-juliette-qu%D0%93%C2%A9bec&7ae=c8 Note: A html file is created under your Project with the above content.