
1126
DEVELOPING
COLDFUSION 9 APPLICATIONS
Using Web Elements and External Objects
Las
t
upda
te
d 8/5/2010
About ColdFusion, Java, and J2EE
ColdFusion is built on a J2EE-compliant Java technology platform. This structure 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.
Use an applet on a ColdFusion page
1
Register the applet .class file in ColdFusion Administrator Java Applets Extensions page. (For information on
registering applets, see the ColdFusion Administrator online Help.)
2
Use the cfapplet tag to call the applet. The
appletSource
attribute must be the Applet name assigned in the
ColdFusion 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 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 1128 and “
Interoperating with JSP pages and
servlets
” on page 1129.
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.)
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...