User Guide

Table Of Contents
918 Chapter 37: Integrating J2EE and Java Elements in CFML Applications
To use an applet on a ColdFusion page:
1.
Register the applet .class file in ColdFusion MX Administrator Java Applets Extensions page.
(For information on registering applets, see the ColdFusion MX Administrator online Help.)
2.
Use the cfapplet tag to call the applet. The appletSource attribute must be the Applet name
assigned in ColdFusion MX Administrator.
For example, ColdFusion includes a Copytext sample applet that copies text from one text box to
another. The ColdFusion Setup automatically registers the applet in the Administrator. To use
this applet, incorporate it on your page. For example:
<cfform action = "copytext.cfm">
<cfapplet appletsource = "copytext" name = "copytext">
</cfform>
About ColdFusion and JSP
ColdFusion MX supports JSP tags and pages in the following ways:
Interoperates with JSP pages: ColdFusion pages can include or forward to JSP pages, JSP pages
can include or forward to ColdFusion pages, and both types of pages can share data in
persistent scopes.
Imports and uses JSP tag libraries: the cfimport tag imports JSP tag libraries and lets you use
its tags.
ColdFusion pages are not JSP pages, however, and you cannot use most JSP syntax on
ColdFusion pages. In particular you cannot use the following features on ColdFusion pages:
Include, Taglib, and Page directives Instead, you use CFML import tag to import tag
libraries, and the
include (or forward) method of the page context object returned by the
ColdFusion
GetPageContext function to include pages. For more information, see “Using JSP
tags and tag libraries” on page 921 and “Interoperating with JSP pages and servlets” on page 922.
Expression, Declaration, and Scriptlet JSP scripting elements Instead, you use CFML
elements and expressions.
JSP comments Instead, you use CFML comments. (ColdFusion ignores JSP comments and
passes them to the browser.)
Standard JSP tags Such as jsp:plugin, unless your J2EE server provides access to these tags in
a JAR file. Instead, you use ColdFusion tags and the PageContext object.
About ColdFusion and servlets
Some Java servlets are not exposed as JSP pages; instead they are Java programs. You can
incorporate JSP servlets in your ColdFusion application. For example, your enterprise might have
an existing servlet that performs some business logic. To use a servlet, the ColdFusion page
specifies the servlet by using the ColdFusion
GetPageContext function.
When you access the servlet with the
GetPageContext function, the ColdFusion page shares
the Request, Application, and Session scopes with the servlet, so you can use these scopes for
shared data.