This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

creating html file from jsp

 
Ikasari Widiyanto
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I would like to know how to create html file from jsp. Can anyone provide me with the sample code or the links of to do that? thanks.
 
Paul Sturrock
Bartender
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "HTML file" do you mean create a new file or generate HTML? JSP's generate HTML anyway - when you access a URL which is a JSP, code runs on the server to generate the correct markup tailored for the request if necessary. If you want to create a new HTML file, you can do this as you would from a normal Java class with the IO packages in the API.
[ December 07, 2004: Message edited by: Paul Sturrock ]
 
Ikasari Widiyanto
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yah, I want to create html file from jsp same like create new text file. Is it something like this?

String path="../../../root/card/lala.html";
try
{
File f = new File(path);
PrintWriter out1 = new PrintWriter(new FileWriter(f));
out1.write("<html>");
out1.write("<head>");
out1.write("<title>Create Christmas e-card</title>");
out1.write("<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">");
out1.write("</head>");
out1.write("<body bgcolor="#F0F0F0">");
out1.write("<table width="751" border="0">");
out1.write("<tr>");
out1.write("<td>To:</td>");
out1.write("<td></td>");
out1.write("<td>From:</td>");
out1.write("<td></td>");
out1.write("</tr>");
out1.write("<tr>");
out1.write("<td>Message:</td>");
out1.write("<td colspan="3"></td>");
out1.write("</tr>");
out1.write("</table>");
out1.write("</body>");
out1.write("</html>");
out1.close();
}catch(IOException e)
{
e.printStackTrace();
}
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic