Reputation: 163
I created a component object like this in page1.cfm, to call one of the cfc's functions: IsDigits:
<CFSET MyObj = New cfcomponents.MyComp.RecordValidation(Trim(session.userid)
,Trim(session.yr))>
<CFSET MyObj.IsDigits(st_SSN_and_BDates)>
After page1.cfm is finished processing, it goes to page2.cfm using:
<script>
window.location="page2.cfm
</script>
(I can't use cflocation because of cfflush that I use on almost every page).
In page2.cfm, I still need to call different functions that exist in the RecordValidation.cfc. I'm wondering if I have to run
<CFSET MyObj = New cfcomponents.MyComp.RecordValidation
... one more time?
Upvotes: 1
Views: 63
Reputation: 29870
There's no limit to how many times one can create objects. If you need another one in the next request... create another one!
Do you perhaps need to elaborate on the problem you're perceiving you're having, so we can give you a more exacting answer?
Also perhaps look into using something like DI/1 or WireBox to manage your objects more strategically? It depends on your requirements as to whether something like that will help you.
Upvotes: 2