Title: Message
"but in general, a CFC instance that is persisted across requests holds onto the page context of the request during which it was created."
 
"Page Context Bug" occurs only when the *.cfc instance is persisted in any Memory scope..?
 
e.g
server.someInstance = createObject("Component","MyCFC");
Or
application.someInstance = createObject("Component","MyCFC");
Or
session.someInstance = createObject("Component","MyCFC");
 
All the above instances will lead to "Page Context Bug" right ?
 
So in the below cases... we shouldnt have any problems.. setting any scope variables within CFC's
 
request.someInstance = createObject("Component","MyCFC");
Or
variables.someInstance = createObject("Component","MyCFC");
 
 
Thanks
Joe Eugene
----- Original Message -----
Sent: Friday, June 20, 2003 2:33 AM
Subject: RE: [CFCDev] Setting Scoped Vars in CFC's - Was (Dynamic CFC Calls)

The "page context bug" is the issue to watch out for.  If you search for "page context bug" on Google you will find more than you ever wanted to know -- since it has been covered in depth on this list in the recent past I won't get into the details, but in general, a CFC instance that is persisted across requests holds onto the page context of the request during which it was created.

If you aren't persisting your CFC instances in memory across requests it's not something you need to even think about.  I would also not be surprised, given that this is an acknowledged and much maligned bug, if you see fixes to all page context issues in future maintenance release of CFMX.
 
 
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Thursday, June 19, 2003 10:18 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Setting Scoped Vars in CFC's - Was (Dynamic CFC Calls)

Just wondering, havent seen any docs on this.
 
Are there any problems setting/manipulating scope variables like
1. Server Scope
2. Application Scope
3. Request Scope
4. Client Scope
 
Variables within CFC's.. Appreciate any input.
 
Thanks,
Joe Eugene
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Nathan Dintenfass
Sent: Wednesday, June 18, 2003 2:21 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Tuesday, June 17, 2003 11:11 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

How do i use argumentCollection? is there some kinda collection available in CFMX like Java Collections?
 
Thanks,
Joe
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Nathan Dintenfass
Sent: Wednesday, June 18, 2003 1:21 AM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

If you want to pass the argument names dynamically, I suggest you use the argumentCollection
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Tuesday, June 17, 2003 8:13 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

 
Thanks Nathan,  I knew.. there was a way around the "evaluate"....
It was really bothering me.. to advocate NOT to use "evaluate" and
having forced to use it.
 
One more question.. havent tested it..
Can i pass the parameters in
value= variables[objName].dynMethod(request.param1,request.param2);
 
Thanks
Joe Eugene
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Nathan Dintenfass
Sent: Tuesday, June 17, 2003 6:19 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

A similar method, if you need the dynamically called method to have access to the CFC internals might be:
 
<cfscript>
object  = createObject("component", "yourComp");
 objName  = "object";
 methodName = "yourMethod";
 variables[objName].dynMethod = variables[objName][methodName];
 value= variables[objName].dynMethod();
 writeOutput(value);
</cfscript>
 
In the original, you are "stripping" the method off the CFC instance and making it local.  In my method you are "tacking" the dynamic method back onto the CFC instance.  It only matters if the method you call also calls private/public methods of the CFC and/or uses instance data of the CFC.
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Adam Cameron
Sent: Tuesday, June 17, 2003 2:57 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Dynamic CFC Calls

This works (tested):
<cfscript>
 object  = createObject("component", "yourComp");
 objName  = "object";
 methodName = "yourMethod";
 dynMethod = variables[objName][methodName];
 value= dynMethod();
 
 writeOutput(value);
</cfscript>
 
Is that what you're after?
 
Adam Cameron
Application Developer
Straker Interactive

[EMAIL PROTECTED]
Fax + 64 9 3605870
DDI +64 4 4965664

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Joe Eugene
Sent: Wednesday, 18 June 2003 7:59 a.m.
To: [EMAIL PROTECTED]
Subject: Re: [CFCDev] Dynamic CFC Calls

Thanks Samuel... but that does NOT work.
 
The only way i can get it to work is using an evaluate.... and i really dont want to use "evaluate"
 
 variables.execMethod="request."&variables.varClass&"."&variables.varMethod;
 '#variables.varName#'= evaluate(variables.execMethod);
 
Your Code...
 variables[varName] = request[variables.varClass][variables.varMethod](); // Complains about "()"
 
The compiler complains about the "()" at the end... can u get it to work?
 
Thanks
Joe Eugene
 
 
 
----- Original Message -----
Sent: Tuesday, June 17, 2003 3:45 PM
Subject: RE: [CFCDev] Dynamic CFC Calls

two ways, 
 
1.
 
request.dataObj = createObject("Component","Website/MyData");
 
varObj="dataObj";
varMethod="getStateData"; // removed the parens
varName="someData";
 
variables[varName] = request[varObj][varMethod]();
 
2.
 
<cfinvoke component="#request[varobj]#" method="#varMethod#" returnVariable="#varName#">
 
 
Untested but both should work.
 
hth,

Sam
 
 
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]On Behalf Of Joe Eugene
Sent: Tuesday, June 17, 2003 3:38 PM
To: [EMAIL PROTECTED]
Subject: [CFCDev] Dynamic CFC Calls

Anybody know how to dynamically call methods in CFC's
 
<cfscript>
request.dataObj = createObject("Component","Website/MyData");
 
varObj="dataObj";
varMethod="getStateData()";
varName="someData";
 
 
// Now, i want to be able to call the CFC Dynamically, something like
 
'#varName#'=request["#varObj#"]["#varMethod#"];
 
//.#varMethod# doesnt work either.
 
</cfscript>
 
I am getting the below from the above code.
"Element getleftNavLinks is undefined in a Java object of type class coldfusion.runtime.TemplateProxy referenced as"
 
What am i missing?..
 
Thanks
Joe Eugene

Reply via email to