Chapter 2. Web Programming with Java

Table of Contents

2.1. Overview
2.2. Working with Java Applets
2.2.1. Connecting
2.2.2. Applet Configuration
2.2.3. Specifying Colors
2.2.4. Customization
2.2.5. Browser Limitations
2.3. Configuring the DataHub Web Server
2.4. Testing the DataHub Web Server
2.5. In the web page
2.5.1. Data model
2.5.2. Example HTML coding
2.5.3. Using a Base applet
2.5.4. Using Listener applets

2.1. Overview

The DataHub lets you put live data into Java applets that are embedded in a web page. When the someone visits the web page, the Java applet attaches to the DataHub and the applet starts to receive live data updates without refreshing the page.

Here is an overview of how your code gets live data from the DataHub to a web page.

  1. The Browser Loads the HTML

    1. The web browser follows the URL to the web server.
    2. The web server returns the HTML code for the page.
  2. The Browser Loads the Java code

    1. The browser reads the HTML code and encounters the embedded APPLET code.
    2. The APPLET code instructs the browser to go back to the web server and load the Java code.
    3. The web server provides the Java code.
  3. The Browser runs the Java code

    1. The browser runs the Java code (in the Java Virtual Machine).
    2. The Java code instructs the Java VM to connect to the DataHub running on the server computer. From that point on, all communication is between the Java applet and the DataHub only. The web server is not involved.
    3. In the browser, the Java code tells the Java plug-in how to display the information coming from the DataHub.