Example: 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
Object Request Broker (ORB) that this client is an applet rather than
a stand-alone Java application or servlet.
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 WebSphere® Application
Server 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, you
must 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);