User Guide
Before You Begin Developing CFX Tags in Java 391
Before You Begin Developing CFX Tags in Java
While implementing CFX tags in Java is easy, you should consider the information in
this section before you begin developing them.
Sample Java CFXs
Before you begin developing a CFX tag in Java, you might want to study sample CFX
tags. You can find the Java source files for the examples on Windows in the
cfx\java\distrib\examples subdirectory of the main installation directory. On UNIX
systems, the files are located in the cfx/java/examples directory. The example tags
are as follows:
•
HelloColdFusion Prints a personalized greeting. Demonstrates the minimal
implementation required to create a CFX.
•
ZipBrowser Retrieves the contents of a zip archive. Demonstrates how to
generate a ColdFusion query and return it to the calling page.
•
ServerDateTime Retrieves the date and time from a network server.
Demonstrates attribute validation, using numeric attributes, and setting
variables within the calling page.
•
OutputQuery Outputs a ColdFusion query in an HTML table. Demonstrates
how to handle a ColdFusion query as input, throw exceptions, and generate
dynamic output.
•
HelloWorldGraphic Generates a “Hello World!” graphic in JPEG format.
Demonstrates how to dynamically create and return graphics from a Java CFX.
Setting up your development environment to develop CFXs in
Java
You can use a wide range of Java development environments, including the Java
Development Kit (JDK) from Sun to build Java CFXs. You can download the JDK from
Sun http://java.sun.com/j2se.
Although you can use the basic JDK, the recommended approach is to use one of the
commercial Java IDEs that provide an integrated environment for development,
debugging, project management, and access to documentation.
Configuring the class path
To configure your development environment to build Java CFXs, 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 Java/classes subdirectory of your
ColdFusion installation directory. Consult your Java development tool’s
documentation to determine how to configure the compiler class path for your
particular environment.