Solve Java Applet and Java Script communication issues

xiaoxiao2021-03-06  41

In most WebGIS platforms, both Java Applets and JavaScript are used to implement the client. Generally use Applet to release graphic data, the attribute data is output by the HTML page. For the appearance, it is generally placed in a framework in a framework. The property query no longer pops up the new page but refreshes the page in the frame. You can also locate the graphic according to the property record, and this interaction between the map belongs It is necessary to resolve communication issues between Java Applets and JavaScript. Figure to the property can specify the same target when you open the window, or you can refresh the properties page by calling JavaScript in the page. The JSObject of the Netscape package provides this support. Attributes to the map must call the applet by embedded JavaScript scripts. By default, JavaScript is a method that cannot call the Applet, you must activate the applet by setting the parameter myscript. Use the Applet to embed the page in two ways, one uses the Applet label, and another uses the Object tag. as follows:

Jad -s java -f -t -8 -r-* .class

->

============================================================================================================================================================================================================= ====================================================================================================================================================================================================================================================

->

The Applet label is a more old way, you have to download all the code each time. The speed is relatively slow, and since most company code signatures are used by the digital signature for testing, each time you talk about whether the dialog is downloaded, etc. In addition, some clients do not install JRE, and cannot be automatically downloaded.

With the Object tag, you can overcome the above shortcomings, automatically detect if the client is installed, and no installation is automatically downloaded from the server side. However, if it is already installed, JRE 1.3 will not download, you need to manually uninstall to download it. The principle of implementation is also very simple, IE finds whether the component is installed under the CLSID key in the CLSID of Object, whether the version is consistent, otherwise download and install the package in the URL pointing to the package. Support .exe, .cab, .dll and .ocx, etc. Applet packaging Follow the Java Extension specification, a small master JAR package that is downloaded every time, others are some extension JAR packages. There is a manifest file in the main jar package, which means which packs depend on, if the package is not in the JRE / LIB / EXT / directory, automatically go to the specified URL to download. Only when the version is updated automatically downloads the local JAR package, that is, the version of the extended package in the main JAR package is automatically updated when the version of the extended JAR package is new than EXT.

But there are several precautions when packaging, otherwise you will come to find an error that you can't find.

1. The main JAR package can reference the extension package, but it will not be in turn. Of course, there is no problem with each other between the extensions.

2. If you use class.Forname () to create an object, the object class created must be in the same JAR package. I didn't try to create an object in another extension. I can try it if you are interested.

3, the class of cyclic references is best playing in a JAR package, such as A reference B, B reference A, then A and B are best placed in a JAR package.

转载请注明原文地址:https://www.9cbs.com/read-74363.html

New Post(0)
CopyRight © 2020 All Rights Reserved
Processed: 0.044, SQL: 9