Text / jeremiah talkar
trust
1. The idea of chat demonstration procedures, together with this article is my own. All chat procedures I have ever seen are not completely Java-based html. My method is a good balance between these two methods.
2. I collected technical information between Java and JavaScript communication through a large number of articles after reading a large number of articles in the Netscape developer site.
3. I first read the Javascript Apostle on the netscape site, "unknown applet (Faceless Applet)" when reading Danny Goodman's article. So I used this very cut term for the trust of Danny.
give up
1. The techniques discussed in this article have been tested using Internet Explorer 5.0 and Netscape Navigator 4.7 on Windows 2000 Professional machines. In the best work I know, these technologies should run on any browser 4.0 or more, but I can't guarantee me, because I don't have time to test it with these versions.
2. Because JavaScript is the only language that is supported in both major browsers, all script code uses this language. I used an available commercial plugin on http://www.ncompasslabs.com, which allows Netscape Navigator to support VBScript, but when I go to their site to verify this information, this product has not been listed.
introduction
I have been engaged in modern COM for two years, and now is the technical leadership of our company's E-commerce product team. I understand that the interface design and in different environments are like Visual C , Visual Basic's importance is effective under scripting. The ability of interface-based programming is always established in my mind, and as a software engineer I tried to apply it to everything I involved.
In the past year, when the ASP script is used as a binder for these objects, the experience tells us that all business logic should be compressed within COM objects. Designing and developing typical infrastructure and business objects require a higher technical device, it is used to require the actual use of the same thing. The preferred environment for developing these objects (at least in my team) is Visual C / ATL / STL. Microsoft also encourages Visual Basic to become the development environment that these objects can be selected.
These objects are represented as "unknown" because they achieve many logic but except for user interfaces. Its performance level is not a sufficient customer is an incumbent customer (this customer has logic of the information and aggregation information from the end user). This kind of customer then uses this information to do something meaningful by using unknown objects. This whole idea is that when the business object changes the unvermissive performance level, the representative requirements of many customers are customized. The change in the performance level can also be implemented by using fewer empirical procedures.
Apply these same principles to your browser environment, when using a scripting language processing performance, logic of compression height development in the "unknown" binary module looks logically. The options for these modules on the Windows platform are the Java Applet and ActiveX Control / Server. The focus of this article is to complete this goal using Java Applet, because Applet is independent of browser, platform, and processor (mostly for most).
Short history of applet
Sun Microsystems is introduced into Java Applet in the luminous role in 1895. Applet immediately won the WEB world, because they added the ability to dynamically display the Web content in a browser that was originally a static HTML world. In the initial days, using Java Applet as the best way to increase dynamic content in the web page. Initially Microsoft tried to use their ActiveX Control technology against the Java Applet provided by Sun, but there are two main issues in the web page internal use:
● The binary module is specified by the processor, so it is not suitable as part of the web page. One of the main reason for World Wide Web is the fact that most of the webpages written in W3C standard HTML is unknown to browser and processors. The ActiveX control is not in line with this example.
● Safety is a big problem because the control writer has enough rights to access resources on the client machine. The named control allows anyone to view the webpage and smart to download a decision of a specific control on his / her machine, but all him is doing a button accidental click (or happily ignored), This will leave a client that is vulnerable, which is also in line with the intention of malicious control writers.
When the dynamic HTML finally started, things changed thoroughly. Document Object Model uses components that can be designed, which exposes web elements with their own properties and methods. Even if Internet Explorer and Netscape Navigator browser have many different dynamic HTMLs, there are many different dynamic HTMLs, but use script code programming changing display page content itself is a huge success. Applet suddenly begins to look old and rough. W3C has finally adjusted the new type of dynamic HTML, and the new type of dynamic web page is tone.
In the browser, you have the following advantages to using Java Applet:
● Applets (for most applets) can work on multiple browsers, platforms, and processors.
● Java language is a typical a powerful conceptual language.
● JDK has a number of useful classes that are typically created in the high-level library.
● The technology has been conceived, and the applet can only be run in the box with the default value. If they want to break the limit, the applet must be named.
● Applets can be contacted with web servers when they send back user information, upload / download files, and the like. The named Applet can be contacted with any server, not just a host.
● The Applet code cannot be seen through the "View Source File" option, so the intellectual property rights are protected.
● Java's .class file is very small, the result is very fast.
Disadvantages using Java Apple:
● In a browser conversation, download Applet is not a web page to use their first time display is that the web page is then refreshed after display. Applet does not have a long duties in the browser conversation. In fact, this can be considered as an advantage over most cases.
● Applet is spent for a long time initialization.
● Because Java's .Class file is byte code that is interpreted by Java Virtual Machine, JVM, the applet is slower than the local code.
● An applet is just part of the true state on the browser, which does not seamlessly appear in web content. Cascading Style Sheets, CSSs do not directly affect the rectangular area occupied by Applet.
● Netscape Navigator 4.x has ten active Applet limits. I don't know any such limit in Internet Explorer 4.0 . Quick review using Java Applets
Java Applets is included in an HTML web page by using the Applet tag. The 13.4 section of the HTML 4.01 manual on the W3C site illustrates this tag in detail. It also refers to
An HTML page that simply contains Applet is as follows:
hEAD>
applet>
body>
html>
The properties used in the above example are explained below:
Id
Applet instance identifier. The customer script code can know the applet of this ID.
Width
This property specifies the initial width of the Applet display (excluding a window or dialog created by applet). Even if I successfully use the browser mentioned in the "Abandon" section, it is recommended to use the value 1 as the minimum possible width.
HEIGHT
This property specifies the initial height of the Applet display field (excluding a window or dialog created by applet). Just like the width properties, it is recommended to use the value 1 as the minimum possible width.
Code
This property specifies any type of file (including Applet subscript subclass or the path to the class, including the class file itself), which is explained when it comes to the applet's CodeBase.
Codebase
This attribute specifies the basic URI of the applet. If this property is not specified, then it defaults the most recent document as the same basic URI.
Only Code, Width and Height properties are must be.
The PARAM tag contains a value of a pair of names, which allows Applet to install yourself for the first time.
The JavaScript function to call a method on the applet is as follows: it is very simple:
Function setCalculatorMode (MODE)
{
Document.calculator.SetcalculatorMode (Mode);
// Alternative Way to Reference The applet.
// Document.Applets [0] .SETCALCULATORMODE (MODE);
}
script>
Labor division of labor
In the introduction part of this article, I suggest that one method of highly developed browser FFC processing is compressed into unknown Java Applets when processing performance forms through JavaScript code. This method requires two-way communication between Java and JavaScript. The following chapters will study the options available.
The members and functions exposed by JavaScript code Access Java Applet are straightforward, like the setcalculatorMode () function description in the previous section. The applet within the document is not by using its ID / NAME is an index that uses Applet collected.
E.g:
document.Calculator.SetCalculatorMode (Mode); // or document.applets [0] .SetCalculatorMode (Mode); netscape.javascript.JSObject using classes and class completed netscape.javascript.JSException other direction (Java to JavaScript) communication. In order to find these classes, I look for all files that contain string "jsobject" on my hard drive. It is surprising that these documents are widely used in many different programs, including part of the Visual InterDev engineering.
If Netscape Navigator 4.0 is installed on your machine, these .class files are available in the java40.jar file under the
I am also looking for these .class files in the four different .zip files in the
JSOBJECT class
The short description of the JSObject class member function is to better understand the use of this class.
Public Static JSObject getWindow (Applet Applet)
This static method returns a JSObject on the Applet window containing the given. For example: jsobject mainwindow = jsobject.getwindow (this);
Public Object Call (String MethodName, Object Args [])
This function calls a JavaScript method from the Java Applet inside the Java Applet. E.g:
JSObject mainwindow = jsobject.getwindow (this);
String arguments [] = {"90", "2"}; // {"Percent Complete", "Time Remaining"}
Mainwindow.call ("UpdateProgressindicator", arguments;
Public Object Eval (String S)
This method finds a value of a JavaScript expression. The expression is a string of the JavaScript source code that is treated in this object context. E.g:
JSObject mainwindow = jsobject.getwindow (this);
JSObject username = mainwin.eval ("document.userinfoform.username);
Public Object getMember (String name)
This method retrieves an index member of the JavaScript object, equivalent to this.name of the JavaScript object. :
JSObject mainwindow = jsobject.getwindow (this);
JSObject DocumentPage = (JSObject) Mainwindow.getMember ("Document"); jsobject userinfoform = (jsobject) DocumentPage.getMember ("UserInfoForm");
JSObject username = (jsobject) UserInfoform.getMember ("UserName");
Public Object GetSlot (INT INDEX)
This method retrieves an index member of the JavaScript object, equivalent to the JavaScript object of this [Index]. E.g:
JSObject mainwindow = jsobject.getwindow (this);
JSObject DocumentPage = (JSObject) Mainwindow.getMember ("Document");
JSOBJECT Applets = (JSObject) DocumentPage.getMember ("Applets");
Object theapplet = Applets.getslot (Index);
Public Void Removemember (String Name)
This method deletes a designated member of a JavaScript object.
Public void setmember (String name, Object Value)
This method sets a designated member of a JavaScript object. It is equivalent to this.name = value of the JavaScript object. E.g:
JSObject mainwin = jsobject.getwindow (this);
JSOBJECT DocumentPage = (jsobject) mainwin.getmember ("document");
JSObject UserInfoform = (jsobject) DocumentPage.getMember ("UserInfoForm");
JSObject username = (jsobject) UserInfoform.getMember ("UserName");
UserName.setmember ("Value", "Jeremiah S. Talkar");
Public void setslot (int index, object value)
This method sets an index member of a JavaScript object. It is equivalent to this [index] = value of the JavaScript object.
Public String Tostring ()
This method converts JSObject into a string.
The above example is very clear. The public approach to the JSObject class is not limited when tuning the JavaScript function in the JavaApplet. They can also cause an applet to process document object model elements directly.
These complete documents can be obtained on http://developer.netscape.com/docs/manuals/communicator/jsref/pkg.htm.
The document also explains how to process data types between Java and JavaScript.
The meaning of the MayScript property
Even if the applet calls the JavaScript function, or directly accesses the document object model, if the applet tag does not contain the method of jsobject in the MayScript property, the JSObject method will fail. This can make web designers to measure whether an applet can evoke JavaScript.
Unknown APPLETs are unknown in the webpage, but when you use the Java Applet, an applet requires direct communication with another applet. Such a call can also communicate through a media JavaScript function, but familiar with all available options is always better.
The AppletContext interface of the Java.applet package implements an access restriction on the context of the applet, like a browser inserted into the applet, and an applet has other Applets on the web page is also on the same web page.
For example, the following is an HTML page contains two applets:
HTML>