Swing embedded html/jsp

Source: Internet
Author: User
Tags comment tag

For a swing write application, in many projects, it is necessary to embed the page. This not only increases the interactivity and interface operability, but also makes the program more humane.

In the past, most of the interface embedding is mainly based on applets. But for swing-oriented programs, Sun is still offering solutions.

Principle:

Page code:

<object classid= "Clsid:8ad9c840-044e-11d1-b3e9-00805f499d93"
Width= "height=" align= "Baseline"
codebase= "Http://java.sun.com/products/plugin/1.4/jinstall-14-win32.cab#Version=1,4,0,mn" >
<param name= "code" value= "Example.class" >
<param name= "codebase" value= "/" >
<param name= "type" value= "application/x-java-applet;jpi-version=1.4" >
<param name= "model" value= "MODELS/HYALURONICACID.XYZ" >
<param name= "scriptable" value= "true" >

<COMMENT>
<embed type= "application/x-java-applet;jpi-version=1.4" width= "400"
height= "align=" "Baseline" code= "Example.class" codebase= "/"
Model= "MODELS/HYALURONICACID.XYZ"
Pluginspage= "Http://java.sun.com/j2se/1.4/download.html" >
<NOEMBED>
No Java 2 SDK, Standard Edition v 1.4 support for applet!!
</NOEMBED>
</EMBED>
</COMMENT>
</OBJECT>

Explain:

<OBJECT> is the label that the IE browser recommends for embedding the applet. The URI in this tab begins with a "CLSID", which is supported by IE browsers and is not supported by other browsers. The URI begins with "CLSID", indicating that it is an ActiveX control, only properties recognized by IE in Windows, representing a registered ActiveX class in the registry, "CAFEEFAC-0014-0002-0000-ABCDEFFEDCBA" is registered in Windows during the Sun JRE installation and represents the Sun Java Plug-in 1.4.2. So when IE resolves to the tag in the example, it looks through the registry, finds the Java Plug-in, and then launches the JRE, rendering the applet at its current location. Another CLSID value: "8ad9c840-044e-11d1-b3e9-00805f499d93", which represents the current version of the JRE. The CodeBase property specifies a download address for a particular version of the JRE that is automatically downloaded from this address when Java Plug-in is not installed on the client machine. The "scriptable" property is used to specify whether the applet sample interacts with JavaScript on the page.

<embed > is the label of an embedded applet supported by Netscape Navigator 4.x browser, which is rarely supported by other browsers, and is therefore rarely used in practice. This label does not support the passing of parameters to the applet within the PARAM tag.

Therefore, the top of the writing is a compromise to write-----for this mainstream browser to swing support. Include the embed label with the comment tag and place it inside the object tag. IE ignores the contents of the comment tag when it interprets the object label. Netscape Navigator does not recognize the CLSID, does not recognize the comment tag, ignores the outer object tag and comment label, and sees only the contents of the embed tag. In this way, this code can accommodate both IE and Netscape Navigator two of browsers.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.