Thanks for the info. In my opinion, Sean is right in this regard that CFC's were never meant to be used to output content from within, that is now is the Custom Tags role. As we move toward the OO world, the separation of GUI from backend business logic becomes extremely important. Not that I am telling you anything new...:-). I am not sure that this Page Context error will keep me from using CFMX since the benefits out way the costs. I worked with Sean in SF on Macromedia's new site. I have seen the capabilities of the app server and what the new site is capable of....It rocks. The MM new site is predominantly Flash MX frontend to backend CFMX components....Cool Stuff.
Keep the bugs comin' I like to hear of them....:-) -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of S. Isaac Dealey Sent: Saturday, March 01, 2003 6:46 PM To: [EMAIL PROTECTED] Subject: Fw: CFC Bugs was Re: Problem with components as session variables Hey Dan (etc), This is one of those known bugs I mentioned before re: CFC's being talked about on the cf-talk list. Just thought anyone on the list who's not on the cf-talk list might find it interresting. --- START OF FORWARDED MESSAGE ---------------------------------------------- From: [EMAIL PROTECTED] (Sean A Corfield) Date: 03-01-03, 1:36:46 PM Subject: Re: Problem with components as session variables The infamous "page context" bug! A CFC stored in a shared scope cannot reference other shared scopes or use cfoutput. The bug is that when a CFC is first created, the context of the page request that created it is 'stamped' on the CFC instance. When the CFC is referenced from a subsequent page request, the context is no longer valid and thus it cannot reference anything that depends on the page context. And I expect this will segue nicely into a long discussion about how outputting HTML from a CFC method is a Bad Thing(tm)... On Saturday, Mar 1, 2003, at 13:06 US/Pacific, Andy Ousterhout wrote: > The following code produces this when session initiated > > Roles: > Results public Testing > > and this when refreshed: > > Roles:public Testing > > Problem is that the write in the getRoles method does nothing the > second time > application.cfm calls roles. why? > > CODE: > > index.cfm: > > <cfoutput>Testing<c/foutput> > > application.cfm: > > <cfapplication name="omg" > clientmanagement="no" > sessionmanagement="yes" > setclientcookies="no" > setdomaincookies="no" > sessiontimeout="#CreateTimeSpan(0,0,0,60)#"> > > <CFLOCK timeout="3" throwontimeout="Yes" scope="Session" > type="EXCLUSIVE"> > <CFSCRIPT> > IF (NOT ISDEFINED("session.User")) { > session.User = createObject("component", "user"); // > Instantiate User > } > </CFSCRIPT> > > <cfoutput>Roles:#session.User.getroles()#</cfoutput> > </cflock> > > user.cfc: > > <cfcomponent> > > <!--- Create a single handle for the instance data ... ---> > <cfscript> > instance.Roles="public"; > </cfscript> > > <cffunction name="getRoles" access="public" returntype="string" > output="true"> > <cfscript> > writeoutput ("<br>Results"); > </cfscript> > <cfreturn instance.roles/> > </cffunction> > > </cfcomponent> s. isaac dealey 954-776-0046 new epoch http://www.turnkey.to lead architect, tapestry cms http://products.turnkey.to tapestry api is opensource http://www.turnkey.to/tapi certified advanced coldfusion 5 developer http://www.macromedia.com/v1/handlers/index.cfm?ID=21816 ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org ----------------------------------------------- To post, send email to [EMAIL PROTECTED] To unsubscribe: Send UNSUBSCRIBE to [EMAIL PROTECTED] To subscribe / unsubscribe: http://www.dfwcfug.org
