473,788 Members | 2,837 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Generating HMTL pages using Java

1 New Member
Hi Guys,

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

Thanks
Mapoza
Nov 4 '06 #1
1 1386
horace1
1,510 Recognized Expert Top Contributor
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
3534
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 because there aren't the java files generated (example index_jsp.java) If I try to load the main jsp page from JBuilder it seems to work (even if the index_jsp.java, etc....are not visible in project) but if I build a War file and I deploy it under...
13
2395
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 include a module for HTML generation in the standard library? I really would like to see some standardization in this area. Michele Simionato
17
2140
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 in. I think i can work around that (at least a bit) by making a second file that imports the gui generated by wxglade and make classes that extend the original ones. For instance i could have a class MainForm that extends the wxFrame
14
1873
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'; document.getElementById('capabilities').style.visibility='hidden'; } function capabilities() {
4
1605
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 less-than and ampersand perfectly valid in user input. So I've disabled request validation by adding the following to my web.config file.
18
18121
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 device the consumers of your webcontent may use. For example they may use computer screens, but in different sizes and with different resolutions. That means, on one computer screen a single pixel has a different size than on another. Just...
3
2553
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 dumps the content of a LDAP directory including all properties and values and groups the result from the LDAP search by objClass.
2
4279
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 D:\workspace\JavaApplication4\src\javaapplication4\Main.java... Constructing Javadoc information... Standard Doclet version 1.6.0 Building tree for all the packages and classes...
0
2145
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 param0,param1 etc.. here is an examle <xs:sequence> <xs:element minOccurs="0" name="param0" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="param1" nillable="true" type="xs:string"/> <xs:element minOccurs="0" name="param2"...
0
9656
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10175
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10112
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7518
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3675
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.