473,398 Members | 2,343 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Generating HMTL pages using Java

1
Hi Guys,

Can anyone tell me how to generate HMTL pages using simple Java print statements?

Thanks
Mapoza
Nov 4 '06 #1
1 1372
horace1
1,510 Expert 1GB
Hi Guys,

Can anyone tell me how to generate HMTL pages using simple Java print statements?

Thanks
Mapoza
You open a file and write the HTML text to it, e.g.
Expand|Select|Wrap|Line Numbers
  1. import java.io.*;
  2.  
  3. public class Test
  4. {
  5. public static void main(String args[])
  6. {
  7.        try
  8.          {
  9.          BufferedWriter dos = new BufferedWriter(new FileWriter("test.html"));
  10.          // create the HTML data and write it to a file
  11.          String s = "<html>\n<applet code = \"test1.class\" height = 100 width= 300>\n"
  12.                          + "</applet>\n</html>)\n";
  13.          dos.write(s);
  14.          dos.close();
  15.         }
  16.        catch (IOException e)   {System.out.println("error writing to file " + e);}
  17. }
  18. }
  19.  
creates a file test.html containing
<html>
<applet code = "test.class" height = 100 width= 300>
</applet>
</html>)
Nov 4 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Revenge | last post by:
hi all, i've a JBuilder project with some packages and some jsp pages using these packages. When i try to build the project , there aren't errors or warnings but the jsp pages are not built...
13
by: Michele Simionato | last post by:
What is the recommended way of generating HTML from Python? I know of HTMLGen and of few recipes in the Cookbook, but is there something which is more or less standard? Also, are there plans to...
17
by: flupke | last post by:
Hi, i create my GUIs mainly via wxGlade. However when you start of to program and want to do some rearranging to the gui, wxglade overwrites your file and you've got to put your own code back...
14
by: Dafydd | last post by:
I have the following Script in my web page reduce to two pages. <script> function details() { document.getElementById('details').style.visibility='visible';...
4
by: Lee Chapman | last post by:
Hi, I am having difficulty getting the ASP.NET framework to generate valid XHTML. My immediate problem surrounds user input in, for example, textbox controls. I consider characters such as...
18
by: Erich Meier | last post by:
Hello there, is there any way to set the size of images or table cells in HTML not by pixels but by inches or in millimetres? The problem behind this is that you never know what kind of output...
3
by: Thorsten Kampe | last post by:
Hi, This is a fairly general question: is there some kind of module or framework that allows building a tree like structure from certain kind of data? To be specific: I have a program that...
2
by: rednarjess | last post by:
Hello every body; When I want to generate the Javadoc for my project, The result is fine at the bigining of the generating init: Generating Javadoc Javadoc execution Loading source file...
0
by: TeenaRoz | last post by:
Hi, I am using axis jars to convert my java classes into wsdl for API purpose. I notice that, instead of generating the parameter names same as what my method accepts, I am getting it as...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.