I'm new with cfcomponent
I googled for some tutorial on how to work with cfcomponent. I was able to use it in my application but not sure with one area where I need some help.
I used this little javascript (see below) at the bottom of my cf templates especially when I need to continue on my process to other templates
I can't use <CFLOCATION> because in my templates I used <cfflush>
Anyway, my question is not about this javascript, but it is about creating a component object
<script>
window
.location="nameofNextTemplate.cfm";
</script>
Inside of my component, I have the following functions:
<cfcomponent displayname="MyComp">
<CFFUNCTION name="Init" access="public" returntype="any" output="false" hint="Returns an initialized component instance">
<cfreturn THIS />
</CFFUNCTION>
<CFFUNCTION name="Function_1">
...........
</CFFUNCTION>
<CFFUNCTION name="Function_2">
..........
</CFFUNCTION>
<CFFUNCTION name="Function_3">
..........
</CFFUNCTION>
</cfcomponent>
I'm calling Function_1 from A.cfm this way:
<CFSET AddrObject = createObject("component", "cfcomponents.AddrComp").init()>
<CFINVOKE component="#AddrComp#" method="Function_1" param_1="#myparam#">
When codes in A.cfm is done running and if I need to go the B.cfm to continue on processing my next codes, I use the above javascript to navigates to the next cf template.
If I need to call Function_2 from B.cfm, should I do CFSET AddrObject again to initialize the component object again
or I can just do CFINVOKE in B.cfm since AddrObject has been instantiated in A.cfm earlier.
So my confusion has something to do with whether or not I need to keep initializing the component object everytime I need to call Function_1,Function_2,Function_3
from different templates?
Thank you for helping!
