Network Deployment (Distributed operating systems), v8.0 > Develop and deploying applications > Develop Client applications > Develop client applications
Develop applet client code
Applet clients are capable of communicating over the HTTP protocol and the RMI-IIOP protocol. Unlike typical applets that reside on either web servers or WASs and can only communicate using the HTTP protocol, applet clients are capable of communicating over the HTTP protocol and the RMI-IIOP protocol. This additional capability gives the applet direct access to enterprise beans.
Standard applets require the HTML <APPLET> tag to identify the applet to the browser. If you replace the <OBJECT> and <EMBED> tags, make sure that you specify appropriate values for <OBJECT> and <EMBED> tags, especially the <OBJECT classid and <EMBED type values.
In the code for your applet client, when you initialize an instance of the InitialContext class, set properties to specify the computer name, domain, and port, and to identify this program (the client) as an applet.
Example
Applet client tag requirements: Standard applets require the HTML <APPLET> tag to identify the applet to the browser. The <APPLET> tag invokes the JVM of the browser. It can also be replaced by <OBJECT> and <EMBED> tags. The following code example illustrates the applet code using the <APPLET> tag:<APPLET code=”MyAppletClass.class” archive=”Applet.jar, EJB.jar” width="600" height="500" > </APPLET>The following code example illustrates the applet code using the <OBJECT> and <EMBED> tags.
<OBJECT classid="clsid: 8AD9C840-044E-11D1-B3E9-00805F499D93" width="600" height="500"> <PARAM NAME=CODE VALUE=MyAppletClass.class> <PARAM NAME="archive" VALUE='Applet.jar, EJB.jar'> <PARAM TYPE="application/x-java-applet;version=1.5.0"> <PARAM NAME="scriptable" VALUE="false"> <PARAM NAME="cache-option" VALUE="Plugin"> <PARAM NAME="cache-archive" VALUE="Applet.jar, EJB.jar"> <COMMENT> <EMBED type="application/x-java-applet;version=1.5.0" CODE=MyAppletClass.class ARCHIVE="Applet.jar, EJB.jar" WIDTH="600" HEIGHT="500" scriptable="false"> <NOEMBED> </COMMENT> </NOEMBED>WebSphere Java Application/Applet Thin Client for Windows is required. </EMBED> </OBJECT>Attention: To successfully invoke the applet client in WAS version 6.1 or later, the <OBJECT classid and <EMBED type values need to be those shown in the preceding example.
For more information about the <APPLET> tag, see the Sun Microsystems article, Using applet, object and embed Tags.
Applet client code requirements: The code used by an applet to talk to an enterprise bean is the same as that used by a stand-alone Java program or a servlet, except for one additional property called java.naming.applet. This property informs the InitialContext and the ORB that this client is an applet rather than a stand-alone Java application or servlet. The following code example illustrates the applet code using the <APPLET> tag:When you initialize an instance of the InitialContext class, the first two lines in this code snippet illustrate what both a stand-alone Java program and a servlet issue to specify the computer name, domain, and port. In this example, <yourserver.yourdomain.com> is the computer name and domain where WAS resides, and 900 is the configured port. After the bootstrap values ( <yourserver.yourdomain.com>:900) are defined, the client to server communications occur within the underlying infrastructure. In addition to the first two lines for applets, add the third line to your code, which identifies this program as an applet, for example:
prop.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory"); prop.put(Context.PROVIDER_URL, "iiop:// <yourserver.yourdomain.com>:900) prop.put(Context.APPLET, this);
Deploy applet client code
Deploy applet client code
http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/using_tags.html