736
Chapter 33: Integrating J2EE and Java Elements in CFML Applications
About ColdFusion, Java, and J2EE
ColdFusion MX is built on a J2EE-compliant Java technology platform. This lets ColdFusion
applications take advantage of, and integrate with, J2EE elements. ColdFusion pages can do any
of the following:
•
Include JavaScript and client-side Java applets on the page.
•
Use JSP tags.
•
Interoperate with JSP pages.
•
Use Java servlets.
•
Use Java objects, including JavaBeans and Enterprise JavaBeans.
About ColdFusion and client-side JavaScript and applets
ColdFusion pages, like HTML pages, can incorporate client-side JavaScript and Java applets. To
use JavaScript, you write the JavaScript code just as you do on any HTML page. ColdFusion
ignores the JavaScript and sends it to the client.
The
cfapplet
tag simplifies using Java client-side applets.
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 739
and
“Interoperating with JSP pages and servlets”
on page 740
.
•
Expression, Declaration, and Scriptlet JSP scripting elements
Instead, you use CFML
elements and expressions.
Summary of Contents for ColdFusion MX
Page 1: ...Developing ColdFusion MX Applications...
Page 22: ...22 Contents...
Page 38: ......
Page 52: ...52 Chapter 2 Elements of CFML...
Page 162: ......
Page 218: ...218 Chapter 10 Writing and Calling User Defined Functions...
Page 250: ...250 Chapter 11 Building and Using ColdFusion Components...
Page 264: ...264 Chapter 12 Building Custom CFXAPI Tags...
Page 266: ......
Page 314: ...314 Chapter 14 Handling Errors...
Page 344: ...344 Chapter 15 Using Persistent Data and Locking...
Page 349: ...About user security 349...
Page 357: ...Security scenarios 357...
Page 370: ...370 Chapter 16 Securing Applications...
Page 388: ...388 Chapter 17 Developing Globalized Applications...
Page 408: ...408 Chapter 18 Debugging and Troubleshooting Applications...
Page 410: ......
Page 426: ...426 Chapter 19 Introduction to Databases and SQL...
Page 476: ...476 Chapter 22 Using Query of Queries...
Page 534: ...534 Chapter 24 Building a Search Interface...
Page 556: ...556 Chapter 25 Using Verity Search Expressions...
Page 558: ......
Page 582: ...582 Chapter 26 Retrieving and Formatting Data...
Page 668: ......
Page 734: ...734 Chapter 32 Using Web Services...
Page 760: ...760 Chapter 33 Integrating J2EE and Java Elements in CFML Applications...
Page 786: ...786 Chapter 34 Integrating COM and CORBA Objects in CFML Applications...
Page 788: ......