I a test.cfc I have created a component in Application.cfc using
<cffunction name="onApplicationStart">
<cfset application.api = {tst= createObject( "component", "com.Test" )} />
<cfreturn true />
</cffunction>
Now how do I call a method in Test.cfc in my cfm file ?
This code
defines the variable
application.api.tst. You want define a variable by calling a method in this object (CFC).You can define the variable
listin two ways:as Sean describes or by using a simple
CFSETThe value of
listis based on whatever was returned by the functiondoSomething, which is a public function inside the componentcom.Testthat exists in the application variable.You should be able to output of
CFDUMPthe value oflistat this point. If the variable does not have the value you expected, then you need to verify what the functiondoSomethingis returning.