Home
Cloud
Big Data
CI
Install
Samples
Java
Ubuntu
Maven
Archive
ColdFusion
|
onCFCRequest
Introduction
Utiliser la méthode « onCFCRequest »
Introduction
ColdFusion appel automatiquement cette fonction quand une requête cible un CFC.
Utiliser la méthode « onCFCRequest »
Exemple :
Application.cfc
:
<cfcomponent> <!--- This method does not return a value; do not use the cfreturn tag. ---> <cffunction name="onCFCRequest" returntype="void"> <cfargument name="cfcname" type="string" required="true" /> <cfargument name="method" type="string" required="true" /> <cfargument name="args" type="Struct" required="true" /> <cfinvoke component = "#ARGUMENTS.args.cfcname#" method = "#ARGUMENTS.method#" returnVariable = "LOCAL.result" argumentCollection = "#ARGUMENTS.args#" /> <cfdump var="#LOCAL.result#" /> </cffunction> </cfcomponent>
test.cfc
:
<cfcomponent> <cffunction name="fctConcat" access="public" returnType="string" output="false"> <cfargument name="string1" type="string" default="UNDEFINED" /> <cfargument name="string2" type="string" default="UNDEFINED" /> <cfreturn string1 & string2 /> </cffunction> </cfcomponent>
URL : http://www.mtitek.com/oncfcrequestexample/test.cfc?cfcname=test&method=fctConcat&string1=val1&string2=val2
© 2010-2022
mti
tek