Thanks to everyone who replied to that request (no pun intended).  I will
look into it further based on the information you provided.

Martin.

-----Original Message-----
From: Dave Watts [mailto:[EMAIL PROTECTED]]
Sent: 20 February 2002 15:06
To: '[EMAIL PROTECTED]'
Cc: '[EMAIL PROTECTED]'
Subject: RE: Request Scope.


> Can any of you explain to me why the request scope is useful,
> if indeed, it is? It is one of the few scopes I am unfamiliar
> with. Can it be used to enhance my code?

The Request scope is like the local Variables scope, with one major
difference - any variables within it are available not only to your page,
but to any custom tags called by your page (and any custom tags called by
those tags, and so on). There's also one minor difference - you have to
explicitly specify the Request scope to create variables within it.

The primary use of this is to allow easier data sharing among all parts of a
page generating a response to a single request. For example, Spectra uses
quite a few custom tags, which themselves use custom tags, and so on. Rather
than passing data up and down the chain of tags (into tags via attributes,
out of tags via the Caller scope), the Spectra tags use the Request scope.

As for whether it can be used to enhance your code, who knows? It's just
another option when you're using custom tags. You may choose not to use it -
personally, I think that custom tags should be "decoupled" as much as
possible from the calling page, and generally shy away from using the
Request scope to share data between these tags and their calling page, but
others may certainly differ (and I might change my mind also, if I were
building something like Spectra). I tend to use the Request scope for what I
think of as "constants" - variables that I set with essentially static
values in Application.cfm - but I could certainly use the local Variables
scope just the same.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
voice: (202) 797-5496
fax: (202) 797-5444
______________________________________________________________________
Dedicated Windows 2000 Server
  PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to