
255
DEVELOPING
COLDFUSION 9 APPLICATIONS
Developing CFML Applications
Las
t
upda
te
d 8/5/2010
</cfif>
</cflock>
</cfif>
<!--- Set a Session variable.--->
<cflock timeout="20" scope="Session" type="exclusive">
<cfif not IsDefined("session.pagesHit")>
<cfset session.pagesHit=1>
<cfelse>
<cfset session.pagesHit=session.p1>
</cfif>
</cflock>
<!--- Set Application-specific Variables scope variables. --->
<cfset mainpage = "default.cfm">
<cfset current_page = "#cgi.path_info#?#cgi.query_string#">
<!--- Include a file containing user-defined functions called throughout
the application. --->
<cfinclude template="commonfiles/productudfs.cfm">
Reviewing the code
The following table describes the code and its function:
Code
Description
<cfapplication name="Products"
clientmanagement="Yes"
clientstorage="myCompany"
sessionmanagement="Yes">
Names the application, enables Client and Session scope variables,
and sets the client variable store to the myCompany data source.
<cfsetting showDebugOutput="No">
Ensures that debugging output is not displayed, if the ColdFusion
Administrator enables it.
<cferror type="request"
template="requesterr.cfm"
mailto="[email protected]">
<cferror type="validation"
template="validationerr.cfm">
Specifies custom error handlers for request and validation errors
encountered in the application. Specifies the mailing address for use in
the request error handler.
<cfset app_is_initialized = False>
Sets the Application scope variables, if they are not already set. For a
detailed description of the technique used to set the Application
scope variables, see “
Using Persistent Data and Locking
” on page
301.
<cflock timeout="20" scope="Session"
type="exclusive">
<cfif not IsDefined("session.pagesHit")>
<cfset session.pagesHit=1>
<cfelse>
<cfset session.pagesHit=session.p1>
</cfif>
</cflock>
Sets the Session scope
pagesHit
variable, which counts the number
of pages touched in this session. If the variable does not exist, creates
it; otherwise, increments it.
<cfset mainpage = "default.cfm">
<cfset current_page =
"#cgi.path_info#?#cgi.query_string#">
Sets two Variables scope variables that are used throughout the
application. Creates the current_page variable dynamically; its value
varies from request to request.
<cfinclude template="commonfiles/productudfs.cfm">
Includes a library of user-defined functions that are used in most pages
in the application.
Содержание COLDFUSION 9
Страница 1: ...Developing Applications ADOBE COLDFUSION 9...