To create a Java CFX tag, create a class that implements the Custom tag 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.
import com.allaire.cfx.* ;
public class MyHelloColdFusion implements CustomTag {
public void processRequest( Request request, Response response )
throws Exception {
String strName = request.getAttribute( "NAME" ) ;
response.write( "Hello, " + strName ) ;
}
}
javac -classpath cf_root\WEB-INF\lib\cfx.jar MyHelloColdFusion.java
Note: The previous command works only if the Java compiler (javac.exe) is in your path. If it is not in your path, specify the fully qualified path; for example, c:\jdk1.3.1_01\bin\javac on Windows or /usr/java/bin/javac on UNIX.
If you receive errors during compilation, check the source code to make sure you entered it correctly. If no errors occur, you successfully wrote your first Java CFX tag. For information on using your new tag in a ColdFusion page, see Calling the CFX tag from a ColdFusion page.
This section describes the following topics:
ColdFusion 9 | ColdFusion 8 | ColdFusion MX 7 | ColdFusion MX 6.1 | ColdFusion MX | Forums | Developer Center | KnowledgeBase | Bug Reporting
Version 7
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/coldfusion/7/htmldocs/00001092.htm
Comments
ASandstrom said on Oct 19, 2005 at 7:17 AM :