396
Chapter 21 Building Custom CFXAPI Tags
The default value is
reload="Auto"
. This is appropriate for most applications. Use
reload="Always"
during the development process when you must ensure that you
always have the latest class files, even when only a dependent class changed. Use
reload="Never"
to increase performance by omitting the check for changed classes.
Note
The
reload
attribute applies only to class files located in the
classes
directory. The
ColdFusion server loads classes located on the Java class path once per server
lifetime. You must stop and restart ColdFusion Server to reload these classes. For
information on loading Java class files, see “The class loading mechanism” on page
384.
Life cycle of Java CFXs
A new instance of the Java CFX object is created for each invocation of
t
he Java CFX
tag. This means that it is safe to store per-request instance data within the members
of your
CustomTag
object. To store data and/or objects that are accessible to all
instances of your
CustomTag
, use
static
data members. If you do so, you must
ensure that all accesses to the data are thread-safe.
Calling the CFX from a ColdFusion page
You call Java CFXs from within ColdFusion pages by using the name of the CFX that
is registered on the ColdFusion Administrator CFX tags page. This name should be
the prefix
cfx_
followed by the class name (without the .class extension). The
following CFML page calls the
HelloColdFusion
custom tag:
<html>
<body>
<cfx_HelloColdFusion NAME="Les">
</body>
</html>
To test the CFX
:
1
Create a new source file in your editor and enter the preceding CFML code.
2
Save the file in a directory configured to serve ColdFusion pages. For example,
you can save the file as C:\inetpub\wwwroot\cfdocs\testjavacfx.cfm on Windows
NT or /home/docroot/cfdocs/testjavacfx.cfm on UNIX.
3
If you have not already done so, register the CFS in the ColdFusion
Administrator, as described in “Registering CFXs” on page 404.
4
Request the page from your Web browser using the appropriate URL; for
example:
http://localhost/cfdocs/testjavacfx.cfm
Summary of Contents for COLDFUSION 5-DEVELOPING
Page 1: ...Macromedia Incorporated Developing ColdFusion Applications MacroMedia ColdFusion 5 ...
Page 58: ...38 Chapter 3 Querying a Database ...
Page 134: ...114 Chapter 7 Updating Your Database ...
Page 210: ...190 Chapter 10 Reusing Code ...
Page 232: ...212 Chapter 11 Preventing and Handling Errors ...
Page 238: ...218 Chapter 12 Using the Application Framework ...
Page 262: ...242 Chapter 12 Using the Application Framework ...
Page 278: ...258 Chapter 13 Extending ColdFusion Pages with CFML Scripting ...
Page 320: ...300 Chapter 15 Indexing and Searching Data ...
Page 336: ...316 Chapter 16 Sending and Receiving E mail ...
Page 374: ...354 Chapter 18 Interacting with Remote Servers ...