• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create a HTML file using core java??

 
Murali Obla
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I am in need of your help. I have a piece of code which reads data from a database and writes it to a flat file. Instead of writing it to a flat file we have to present it in a structured way using HTML.Here I don't know that I have to create (embed) the whole HTML tags in the program itself or how to generate a HTML file using core Java. .This is just to display the output(something like reports in HTML).Please help me folks.This is very urgent.
TIA,
Regards,
Murali
 
Riaz Mohamed
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Well what do u mean by core java.. If u need to throw the report back to the browser u could use a servlet and embedd html tags on it.
If u do need to write a file on to u'r hard disk use i/o for the same. let me know if u do need a program to srite a html file.
regards
riaz
 
Chandresh Patel
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could take an approach of JSP Engine. Create a template.html file, with some markers in it for Dynamic data, like <INSERT NAME HERE>. Then use input streams to read from template.html and write it to some other html file. While doing this when you encounter the <INSERT NAME HERE> , write name instead of the custom tag. Ofcourse this gets complicated when you have more dynamic data and need to organize them in some structure, but it will be surely easier and configurable.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!