You've got it correct. An instance of a cfc created on a page is no
different than any other variable created on a page - it's gone when you
leave the page.
Where it gets murky with CFC's is whether or not you're creating it with
createObject or using cfinvoke to just hit a method that doesn't return an
instance of the object. So, for instance this would work:
<cfset myObj = createObject("component", "myComponent")>
<cfoutput>
#myObj.sayHello()#
</cfoutput>
And, this would work:
<cfinvoke
component="myComponent"
method="sayHello"
returnVariable="hello">
</cfinvoke>
<cfoutput>#hello#</cfoutput
But, the first one creates an object (myObj) that can be re-used
throughout your page. So, you could also do,
<cfoutput>#myObj.sayGoodbye()#</cfoutput> without
re-instantiating the object. The second does not keep a reference to
the object for further use.
On 10/13/05, Andy Mcshane <[EMAIL PROTECTED]> wrote:
>
> Just a quick question to help clear, hopefully, the last of the muddy
> waters with regards to how CFC's work.
>
> A CFC that is initialized and stored within the application/session scope
> is then available to use everywhere as required.
>
> Now I just want clarification on CFC's created at page level. If I create
> an instance of a CFC on my page, carry out some processing and then do
> cflocate to another page am I correct in assuming that my CFC instance is
> now gone and if I wish to re-use it I must create another instance of it? I
> am just a little confused on the whole lifecycle bit of CFC's, can anyone
> provide some clarity?
>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Find out how CFTicket can increase your company's customer support
efficiency by 100%
http://www.houseoffusion.com/banners/view.cfm?bannerid=49
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:220881
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54