In MX you no longer have to sandwich Application variables with a CFLOCK
(this is handled by the Java runtime).

However, you would want to wrap up your Application setting in some type of
code that would avoid continually setting them all the time.

Something like....


<CFIF Not IsDefined("Application.initDone")>
� � � � <CFSET Application.initDone = true>
� � � �<!--- set the rest of your application vars here --->
</CFIF>


If you decide you want to change any of those variables you would have to
have another page that clears the "initDone" variable from the Application
scope (OR put them outside of that place so they are loaded each time).

The reason you use Application scope and not just a defined variable is
because the Application scope is available ALWAYS (as is the SESSION
scope). �Most of the other scopes only have limited visibility.

If you are not wanting to expose the variables across the whole application
space then consider using the "Request" space. �This is visible to the
current page and everything that the current page calls.

Normal variables (without scope) are created in the "Variables" scope - so
still really do have a scope.


Gary Menzel
IT Operations Brisbane -+- ABN AMRO Morgans Limited
Level 29, 123 Eagle Street BRISBANE QLD 4000
PH: 07 333 44 828 �FX: �07 3834 0828

[EMAIL PROTECTED] wrote on 01/31/2003 03:54:45 PM:

> Hi All,
>
> Is there any real point in setting an application variable in the top
level
> application.cfm file.
> If the <cfset application.DataSource = "dbname"> is going to be in each
> application.cfm
> file used in the system, then wouldn't it be smarter to just have
>
> <cfset DataSource = "dbname"> in application.cfm
>
> and reference it by
>
> <cfquery name="getUser" datasource="#DataSource#">
>
> If your going to use an application variable, I would have thought it
should
> be
> set up once in a login type of page, and not continually reset each time
a
> page is accessed.
>
> Also, if you're setting an application variable shouldn't it be inside a
> cflock?
>
> Phil.
>
>
> ----- Original Message -----
> From: "Geoff Bowers" <[EMAIL PROTECTED]>
> Newsgroups: cfaussie
> To: "CFAussie Mailing List" <[EMAIL PROTECTED]>
> Sent: Friday, January 31, 2003 4:31 PM
> Subject: [cfaussie] Re: difficulties with application and session vars in
CF
>
>
> > pete mawhinney wrote:
> > > Its all in the top folder now and even though its win box I did the
> > > Application.cfm rename for good measure. Still getting the same error
> > > though.
> > >
> > > Here is an example of the useage:
> > > <cfquery name="getUser" datasource="#APPLICATION.DataSource#">
> > > from authenticator.cfc
> > >
> > > and in Application.cfm is the line
> > > <cfset DataSource = "dbname">
> >
> > This needs to be:
> > <cfset application.DataSource = "dbname">
> >
> > And you need to make sure you have an appropriate <CFAPPLICATION> tag
in
> > Application.cfm
> >
> > Just read through the doco on "application" variables -- it is *NOT* a
> > scope that is peculiar to Application.cfm �*ALL* shared memory scope
> > variables in SF must be scoped at all times (ie. application/session).
> >
> > -- geoff
> > http://www.daemon.com.au/
> >
> >
> > ---
> > You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> [EMAIL PROTECTED]
> >
> > MX Downunder AsiaPac DevCon - http://mxdu.com/
> >
>
>
> ---
> You are currently subscribed to cfaussie as:
[EMAIL PROTECTED]
> To unsubscribe send a blank email to
[EMAIL PROTECTED]
>
> MX Downunder AsiaPac DevCon - http://mxdu.com/



---
You are currently subscribed to cfaussie as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MX Downunder AsiaPac DevCon - http://mxdu.com/

Reply via email to