Custom Tag Execution Modes

When ColdFusion Custom Tags are used as tag pairs (with a begin and end tag) the tag code itself is called twice. ThisTag.ExecutionMode will be “start” when the tag is first called and “end” when called the second time. As a rule, all output generation and processing should occur in “end” ExecutionMode, “start” should be used for data validation, establishing default values, and any other initialization code. But regardless of how you use the two modes, don’t ever use “start” to generate starting output and “end” to generate ending output – this type of code is highly error prone, makes error handling extremely complex, and is difficult to debug when problems do occur. (Applies to: ColdFusion 4 (or later))

Leave a Reply