[Top] [Prev] [Next] [Bottom] [Contents]

Concepts

Including a Java applet in your HTML page will enable it to do things that it could not otherwise do. The Java applet is pre-compiled into a class file and held somewhere on your server system. When the page needing the class is loaded, one of the statements in your HTML document, <applet>, indicates that at this point processing of the HTML should stop and an applet should be loaded.

The <applet> statement must include several pieces of information:

A typical <applet> tag in an HTML document might look like this:

<applet code = 	"MyApplet.class" 
		codebase="/saclasses/test" 
		width=400 
		height=300>
</applet>
The various parts here are:

<applet This introduces the tag

code = "MyApplet.class" This tells the browser the path (none here) and the name of the applet

codebase="/saclasses/test" This tells the browser where on the Web Server (relative to the server root-this is a URL) to start with the codebase path and name in order to find the applet. The applet should be located in the directory /htmlroot/saclasses/test.

width = 400 This defines the width of the rectangular area of screen reserved for the applet's use. Typically, it will appear as a grey square

height = 300> This defines the height of the rectangular area of screen reserved for the applet's use. Typically, it will appear as a grey square.

These four are usually the minimum required to display an applet. Sometimes the codebase parameter will be omitted because the code will reside at the root of the Web Server, although storing code here is not recommended.

Often, an applet requires other parameters. These are given to the applet in the form of parameter statements like this:

<PARAM NAME="ParameterName" VALUE="ParameterValue">
that come between the <applet> and </applet> statements. The quotes are optional but usually needed, especially for items with spaces.



[Top] [Prev] [Next] [Bottom] [Contents]

info@bluestone.com
Copyright © 1997, Bluestone. All rights reserved.