Agreed.

The Request scope is useful in certain circumstances, but it is better
programming practice to explicitly show the interface to a custom tag by passing
values to it rather than setting a request variable that the custom tag then has
to know about (as that hides the API).

However, the following seems to be a good use of Request scope variables as a
way to make server, application or session variables available on any page in a
threadsafe way:

<cflock name="#application.applicationName#" type="exclusive" timeout="2">
        <cfset request.app = duplicate(application)>
</cflock>

After this all application variables can be accessed on a page with
"request.app.VARIABLENAME". (You can do a similar thing for session variables.)
this only works at 4.5.1 but seems to be very fast and avoids having to CFLOCK
all application level variables.

for those apps that use quite a few application or session variables throughout
the pages, the above seems to be a good way to avoid having to write a million
CFLOCKs.

david
webworld studios, inc.

-----Original Message-----
From: t@dreamlab [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 10, 2000 6:53 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: Passing variables


>>----- Original Message -----
>>From: "Jonathan Trow" <[EMAIL PROTECTED]>
>>Sent: Tuesday, August 08, 2000 5:04 AM
>>Subject: Passing variables
>>
>> What would be the best way between a page and a display
>>handler used on it?


Simply using Request.* to communicate with a handler is "bad."
Try using stParams.


In the "thing" that is calling an method/handler:

<CFSET stParams=StructNew()>
<CFSET stParams.theText="Giant Potato">
<CFSET stParams.f3=true>
<cfa_contentObject
  dataSource="#request.cfa.objectstore.dsn#"
  lObjectIDs = "#grabPage.objectID#"
  bSecure=false
  method="display_link"
  stParams="#stParams#"
  >


In the method/handler that is being called:

<CFPARAM name="Attributes.stParams.f3" default=false>
<CFIF Attributes.stParams.f3>
  <CFSET theImageFile="#theImageFile#_locked">
</CFIF>


NOTE: I'm not totally against using Request.* (I actually use a module
that sets Request.myPageID and Request.myPageName so that
all the handlers/containers/objects on the page won't need to look
it up anytime they need to know the name of the page ...)



--
dreamlab imagineering : custom interactive solutions for business
                  http://dreamlab.com  .  214.526.3080


------------------------------------------------------------------------------
To Unsubscribe visit
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk or
send a message to [EMAIL PROTECTED] with 'unsubscribe' in
the body.

------------------------------------------------------------------------------
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/spectra_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to