Update HTML Controls

This article has four sections:

To see


Overview of the sample

The HTMLControls sample demonstrates Java updating HTML controls. The HTML controls are created using tags on the HTML page.

About the server

INTRINSC.OCX is an ActiveX control interface for the HTML intrinsic controls. These controls are typically created by tags in the HTML source for a Web page. As such, the changes you can make are limited. The Java applet can interact with the HTML controls at practically the same level as the user who is viewing the Web page.

In this sample, the Java applet sets the properties of the HTML controls on the same HTML page. The controls shown in this sample are:

About the sample

This sample features a simple HTML page with a table containing a variety of HTML controls on the left and a Java applet on the right. In the Window_OnLoad handler (VBScript), the HTML controls are passed to the applet. See updatecontrols.loadControls for the code to associate Java objects with the HTML controls. The Java applet can now modify the HTML controls. See updatecontrols.action for the code that changes the HTML controls. In Developer Studio, use ClassView to help you find these methods.

About security

COM components can access any system resources. As such, they are both very powerful and potentially very dangerous. In the Java virtual machine (VM) in Microsoft® Internet Explorer 3.0 only trusted class files can use COM components. Class files from digitally signed CAB files are trusted.

If the HTML file is run from Microsoft Developer Studio, the class files are also trusted. This can be very helpful during applet development. However, to deliver your applet to other users, you must put it in a signed CAB file.

When run as an application, the class file must already be on your machine. When run as an applet, the class file may be downloaded to your machine. There is a potential security threat running downloaded software. To run a Java applet that uses COM components, the applet code must be trusted. For more information on trusted class files, see the CabAndSign sample.

Return to the top of this article.


How to use this sample

To run the HTMLControls sample:

    1. Create a Java interface for the COM component.
      See
      Creating a Java Interface for a COM component.
    2. In Developer Studio, build the applet.
    3. In Developer Studio, run the applet.
      If this is the first time you have run the applet, Developer Studio will prompt you for the name of the class. Type updatecontrols.

Return to the top of this article.


Troubleshooting this sample

If you get the error message java.lang.VerifyError:

If you get the error message ClassNotFoundException:

If you get the error message UnsatisfiedLinkError:

Return to the top of this article.


Files in this sample

This sample includes the following files.

Project files:

Support files:

Return to the top of this article.