Processing Requests - MACROMEDIA COLDFUSION 4.5-DEVELOPING WEB Develop Manual

Developing web applications with coldfusion
Table of Contents

Advertisement

280
To create a Java CFX:
1.
Create a new source file in your editor.
2.
Enter the code, for example, the code below illustrates the creation of a very
simple Java CFX named
page:
import com.allaire.cfx.* ;
public class HelloColdFusion implements CustomTag
{
public void processRequest( Request request, Response response )
{
}
}
3.
Save the file as
4.
Compile the java source file into a class file using the java compiler. If you are
using the command line tools bundled with the JDK, you do this using the
following command line, which you execute from within the
javac -classpath cfx.jar HelloColdFusion.java
Note
c:\jdk12\bin\javac
If you receive errors during compilation, check the source code to make sure you have
entered it correctly. If no errors occur, you have just successfully written your first Java
CFX!
As you can see, implementing the basic
This is all a Java class has to do to be callable from a CFML page.

Processing Requests

Implementing a Java CFX requires interaction with the
passed to the
ColdFusion queries will also interface with the
package, located in the
objects.
Query
A basic overview of each of these object types is provided below. To see a complete
example Java CFX that uses
Example" on page
SimpleJavaCFX
throws Exception
String strName = request.getAttribute( "NAME" ) ;
response.write( "Hello, " + strName ) ;
HelloColdFusion.java
The above command will only work if the java compiler (
is in your path. If it is not in your path, specify the fully qualified
path, for example:
on Windows NT, or
method. In addition, CFXs that need to work with
processRequest
classes/cfx.jar
,
Request
Response
284.
Developing Web Applications with ColdFusion
that writes a text string back to the calling
in the
subdirectory
classes
/usr/java/bin/java
interface is very straightforward.
CustomTag
and
Request
object. The
Query
archive contains the
Request
, and
objects, see the
Query
directory:
classes
)
javac.exe
c on Solaris
objects
Response
com.allaire.cfx
,
, and
Response
"ZipBrowser

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the COLDFUSION 4.5-DEVELOPING WEB and is the answer not in the manual?

Subscribe to Our Youtube Channel

This manual is also suitable for:

Coldfusion 4.5

Table of Contents