import java.io.*; import java.util.*; public class HTML2 { public static void main(String[] args) throws IOException { File HTML = new File("Html2.html"); //create a new file for output. BufferedWriter out = new BufferedWriter(new FileWriter(HTML)); out.write("WELCOME TO MY JAVA WEB REPORT CLASS"); out.write("

This is my first web generator using Java"); out.write("

Testing web report

"); out.write(""); out.write(""); out.write(""); out.write(""); out.write(""); out.write(""); out.write(""); //Now we use loop to GENERATE fields in our table. String fname = "Details.csv"; fname = fname.trim(); BufferedReader in = null; try{ in = new BufferedReader(new FileReader(fname)); } catch(Exception e){ System.out.println("Unable to open the specified file!"); System.out.println(e); System.exit(1); } StringTokenizer st = null; int total = 1, linenum = 0, qty = 0; double price_unit = 0., sum = 0.; try{ in = new BufferedReader(new FileReader(fname)); String line = in.readLine(); while(line != null){ st = new StringTokenizer(line, ","); while(st.hasMoreTokens()){ out.write(""); out.write(""); out.write(""); out.write(""); out.write(""); out.write(""); out.write(""); }//end of inner-WHILE line = in.readLine(); }//end of outer WHILE out.write("
OrderProductUnit PriceQuantityDiscount
" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "" + st.nextToken() + "
"); out.write(""); } catch(Exception e){ System.out.println(e); System.exit(0); } out.close();//ALWAYS CLOSE YOUR FILE!!! } }