User Guide

onRequestEnd 955
onRequestEnd
Description
Runs at the end of a request, after all other CFML code.
Syntax
<cffunction name="onRequestEnd" returnType="void">
<cfargument type="String" name="targetPage" required=true/>
...
</cffunction>
See also
onRequestStart
, onRequest, Method summary, “Managing requests in Application.cfc” in
ColdFusion MX Developer’s Guide
Parameters
ColdFusion MX passes the following parameters to the method:
Returns
This method does not return a value; do not use the cfreturn tag.
Usage
This method has the same purpose as the onRequestEnd.cfm page. (You cannot use an
onRequestEnd.cfm page if you have an Application.cfc file for your application.) This method
runs before the request terminates; therefore, it can access the page context, and can generate
output.
This method can be useful for gathering performance metrics, or for displaying dynamic footer
information.
This method can access the requested pages Variables scope only if the Application.cfc file
includes an
onRequest method that calls the page. You can use Request scope variables to share
data with the requested page, even if the Application.cfc file does not have an
onRequest method.
If you call this method explicitly, ColdFusion does not end the request, but does execute the
method code.
Example
The following example displays one of two footer pages depending on whether the user has
logged in:
The
onRequestEnd method in Application.cfc contains the following code:
<cffunction name="onRequestEnd">
<cfargument type="String" name="targetPage" required=true/>
<cfset theAuthuser=getauthuser()>
<cfif theAuthUser NEQ "">
Parameter Description
targetPage Path from the web root to the requested page.