IN THIS CHAPTERWhat Are CFX Tags? 1Introducing the CFX API 3Writing CFX Tags with Java 8Writing CFX Tags with Visual C++ 24Generating Debug Output 38R
10 CHAPTER 30 Extending ColdFusion with CFXFor instance, the tag can be called as shown in the following code snippet. The resulting messagewill incor
11Writing CFX Tags with JavaBasically, every Java CFX tag needs to be a public class that implements the CustomTag interface inthe com.allaire.cfx pac
12 CHAPTER 30 Extending ColdFusion with CFXTo compile your CFX, use javac on the command line to compile the HelloWorld.java file asshown below, adju
13Writing CFX Tags with JavaRegistering the New TagNow that the class has been compiled and placed into ColdFusion’s lib folder, the only thing left t
14 CHAPTER 30 Extending ColdFusion with CFX3. For the Tag Name field, enter the name of the tag, including the CFX_ part but withoutthe angle brackets
15Writing CFX Tags with JavaYo u can even catch exceptions thrown by a CFX and handle them intelligently, using <cftry> and<cfcatch>, like
16 CHAPTER 30 Extending ColdFusion with CFXTable 30.11 (continued)ATTRIBUTE DESCRIPTIONdbschema Optional. The name of the database schema. Not all dat
17Writing CFX Tags with JavaTable 30.12 (continued)ACTION DESCRIPTION COLUMNS RETURNEDGetProcedureColumns PROCEDURE_NAME, COLUMN_NAME,COLUMN_TYPEGetPr
18 CHAPTER 30 Extending ColdFusion with CFXListing 30.3 shows how these objects can be used together to create the <CFX_DatabaseMetaData>tag. Th
19Writing CFX Tags with JavaListing 30.3 (continued)} else if ( strAction.equalsIgnoreCase(“GetViews”) ) {String[] types = {“VIEW”};rs = dbmd.getTable
2 CHAPTER 30 Extending ColdFusion with CFXWhen To Write (and Avoid Writing) a CFX TagGiven the choice between creating a CFX tag or creating a CFML-ba
20 CHAPTER 30 Extending ColdFusion with CFXListing 30.3 (continued)// Fill the array with this ResultSet’s column names for (int col = 1; col <= rs
21Writing CFX Tags with Java The returnAsQuery() function, which accepts any Java-style ResultSet object and makesit available to the calling page as
22 CHAPTER 30 Extending ColdFusion with CFXNOTEBefore this listing will work, you need to create an ODBC data source called ows that points to the ows
23Writing CFX Tags with JavaListing 30.4 (continued)<html><head><title>Database Metadata</title></head><body> <
24 CHAPTER 30 Extending ColdFusion with CFXListing 30.4 (continued)<cfoutput query=”FilmsMetaData”><p><strong>Column: #COLUMN_NAME#&
25Writing CFX Tags with Visual C++To install the CFX Tag Wizard, follow these steps:1. If Visual C++ is currently running, close it.2. Copy the cfxw
26 CHAPTER 30 Extending ColdFusion with CFX7. Enter the name of your CFX tag, including the CFX_ part. If you wish, you may also entera description.8.
27Writing CFX Tags with Visual C++Listing 30.5 shows the code generated by the ColdFusion Tag Wizard. In the next section, this codewill be modified to
28 CHAPTER 30 Extending ColdFusion with CFXListing 30.5 (continued)// Output optional debug infoif ( pRequest->Debug() ){pRequest->WriteDebug( “
29Writing CFX Tags with Visual C++NOTEThe tag computes the population standard deviation, which means that it is most appropriate for analyzing a comp
3Introducing the CFX APIAnother reason to use C++ is the fact that it is generally thought to be faster at extremely CPU-intensive tasks. However, rec
30 CHAPTER 30 Extending ColdFusion with CFXListing 30.5 (continued)// Retrieve value of VARIABLE attributeLPCSTR lpszVariable = pRequest->GetAttrib
31Writing CFX Tags with Visual C++Listing 30.5 (continued)// Add this value to the totaldTotal += atof(thisVal);// Increment the counter of non-null v
32 CHAPTER 30 Extending ColdFusion with CFXListing 30.5 (continued)// case of an unexpected exception)catch( ... ){pRequest->ThrowException( “Error
33Writing CFX Tags with Visual C++NOTEQueries cannot be passed using any attribute name other than query; therefore, only one query can be passed to a
34 CHAPTER 30 Extending ColdFusion with CFXNOTEThe atof() function returns 0 if it encounters a string that can’t be parsed into a number. It doesn’t
35Writing CFX Tags with Visual C++5. Leave the Procedure field set to ProcessTagRequest unless you changed the name of theProcessTagRequest() function
36 CHAPTER 30 Extending ColdFusion with CFXListing 30.7 (continued)---><!---Retrieve film information from database---> <cfquery datasour
37Writing CFX Tags with Visual C++Listing 30.7 (continued)<p>Standard deviation of the merchandise prices: <strong>#NumberFormat(MerchStdD
38 CHAPTER 30 Extending ColdFusion with CFXGenerating Debug OutputIf your CFX tag encounters any problems during its execution, or if you need help fig
39Returning Structures from CFX TagsReturning Structures from CFX TagsAs you probably already know, ColdFusion supports a feature referred to in the d
4 CHAPTER 30 Extending ColdFusion with CFXTable 30.3 C++ Methods for Working with AttributesMETHOD DESCRIPTIONpRequest->AttributeExists(lpszName) D
40 CHAPTER 30 Extending ColdFusion with CFXAside from the name of the tag, the code is exactly the same as Listing 30.6 except that these lines:// Con
41Returning Structures from CFX TagsListing 30.8 (continued)<!---Retrieve merchandise information from database---> <cfquery datasource=”ows
42 CHAPTER 30 Extending ColdFusion with CFXListing 30.8 (continued)<br>Standard Deviation:<strong>#NumberFormat(MerchStats.StandardDeviati
43Using CFX Tags Safely: Locking and Thread SafetyEither line of code, used immediately before the CFX tag, will guard against any potential problemsi
44 CHAPTER 30 Extending ColdFusion with CFXIf the CFX Tag Works with FilesIf the guts of the CFX tag are thread-safe, but you are asking the tag to do
5Introducing the CFX APIWorking with QueriesAny CFX tag may return queries to the ColdFusion page that is calling the tag. The queries canthen be used
6 CHAPTER 30 Extending ColdFusion with CFXTable 30.7 C++ Methods for Working with QueriesMETHOD DESCRIPTIONpRequest->AddQuery(name, columns) Create
7Introducing the CFX APITable 30.8 C++ Methods for Working with String SetsMETHOD DESCRIPTIONstringset->AddString(string) Adds a LPCSTR value to th
8 CHAPTER 30 Extending ColdFusion with CFXTable 30.9 (continued)METHOD DESCRIPTIONrequest.debug() Determines whether the tag has beencalled with the d
9Writing CFX Tags with Java2. Compiling the Java code into the corresponding .class file3. Registering the new CFX tag in the ColdFusion AdministratorI
Kommentare zu diesen Handbüchern