Application of Cell plugin in J2EE system

zhaozj2021-02-08  440

Application of Cell plugin in J2EE system

[Abstract] In an information system based on J2EE platform, Java Applet with rich performance capabilities is an important form of the interface layer. However, Java API is relatively weak for printing, and the documents and reports of printouts require a lot of work. The system described herein solves this problem by introducing an ActiveX control - Cell plugin. In this system, the interface performance is completed by the Java Applet, and the printout is completed by the Cell plugin, and the two are communicated with each other by Sun's set of interface APIs.

First, the interaction of Java Applet and OCX control

1.1 Access the Java Script method and OCX control from Java Applet

Sun offers an API from Java Applet to Java Script in JDK, thereby achieving Java Applet to access DOM objects in the HTML page. The API provides:% java_home% / jre / lib / jaws.jar in the form of a JAR file:% java_home% is the directory of you installed JDK. To add the JAR file to the Environment Variable ClassPath, you can use it to be called from the Java Applet to Java Script. Below is a code instance of the method in calling Java Script:

Import netscape.javaScript. *;

Import java.applet. *;

Import java.awt. *;

Class myapplet extends applet {

Public void init () {

JSObject Win = JSObject.getWindow (this);

JSObject Doc = (jsobject) Win.getMember ("Document");

Win.Call ("f", null;

}

}

In the above code, Win.Call ("f" ("f" ("f", NULL) calls method f () in javaScript.

1.2 Access Java Applet from JavaScript

When running the Java Applet using Java Plugin1.4.x, simply use the method in the Java Applet as the method of the Java Plugin, you can call directly in Java Script. The following describes a simple example:

(1) In the Object tab loaded into the Java Plugin, specify a name with the parameter ID:

ClassID = "CLSID: 8AD9C840-044E-11D1-B3E9-00805F499D93">

...

(2) Add a button on the HTML page, click on the Java script to call the Java Applet from Java Script:

OnClick = "Calculate" Language = "JavaScript">

(3) Assuming that your Java applet is myapplet.java, it has a public method Method1 (), then you can call the method directly with the following Java Script code: