User Guide
108 Chapter 2: ColdFusion Tags
cfexit
Description
This tag aborts processing of the currently executing CFML custom tag, exits the page within the
currently executing CFML custom tag, or re-executes a section of code within the currently
executing CFML custom tag.
Category
Debugging tags, Flow-control tags
Syntax
<cfexit
method = "method">
See also
cfabort, cfbreak, cfexecute, cfif, cflocation, cfloop, cfswitch, cfthrow,
cftry
Attributes
Usage
If this tag is encountered outside the context of a custom tag, for example in the base page or an
included page, it executes in the same way as
cfabort. The cfexit tag can help simplify error
checking and validation logic in custom tags.
The
cfexit tag function depends on its location and execution mode:
Example
<h3>cfexit Example</h3>
<p>cfexit can be used to abort the processing of the currently executing
CFML custom tag. Execution resumes following the invocation of
the custom tag in the page that called the tag.
<h3>Usage of cfexit</h3>
Attribute Req/Opt Default Description
method Optional exitTag • exittag: aborts processing of currently executing tag
• exittemplate: exits page of currently executing tag
• loop: reexecutes body of currently executing tag
Method value Location of cfexit call Behavior
exitTag Base page Terminate processing
Execution mode = Start Continue after end tag
Execution mode = End Continue after end tag
exitTemplate Base page Terminate processing
Execution mode = Start Continue from first child in body
Execution mode = End Continue after end tag
loop Base page Error
Execution mode = Start Error
Execution mode = End Continue from first child in body