Writing a Java CFX tag
253
Setting up your development environment to develop CFX tags in Java
You can use a wide range of Java development environments, including the Java Development Kit
(JDK) version 1.3.1 from Sun, to build Java CFX tags. You can download the JDK from Sun
http://java.sun.com/j2se
.
Macromedia recommends that you use one of the commercial Java IDEs, such as Dreamweaver
MX, that provide an integrated environment for development, debugging, project management,
and access to documentation.
Configuring the classpath
To configure your development environment to build Java CFX tags, you must ensure that the
supporting classes are visible to your Java compiler. These classes are located in the cfx.jar archive,
located in the lib subdirectory of your ColdFusion installation directory. Consult your Java
development tool documentation to determine how to configure the compiler classpath for your
particular environment.
The lib directory created by the ColdFusion setup program serves two purposes:
•
It contains the supporting classes required for developing and deploying Java CFX tags. This is
the com.allaire.cfx package located in the cfx.jar archive.
•
It supports a feature that reloads Java CFX tags located in the directory every time they are
changed. Although this is not the default behavior for other Java classes, this behavior is very
useful during an iterative development and testing cycle.
When you create new Java CFX tags, you should develop them in the
web_root
/WEB-INF/classes
directory. Doing this simplifies your development, debugging, and testing processes.
After you finish with development and testing, you can deploy your Java CFX tag anywhere on
the classpath visible to the ColdFusion embedded JVM. For more details on customizing the
classpath, see
“Customizing and configuring Java”
.
Customizing and configuring Java
Use the JVM and Java Settings page on the ColdFusion MX Administrator Server tab to
customize your Java development environment, such as by customizing the classpath and Java
system properties, or specifying an alternate JVM. For more information, see the ColdFusion MX
Administrator online Help.
Writing a Java CFX tag
To create a Java CFX tag, create a class that implements the
CustomTag interface
. This
interface contains one method,
processRequest
, which is passed
Request
and
Response
objects
that are then used to do the work of the tag.
The example in the following procedure creates a very simple Java CFX tag named
cfx_MyHelloColdFusion
that writes a text string back to the calling page.
Summary of Contents for COLDFUSION MX 61-DEVELOPING 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: ......