It is very common for applications to display confirmation messages or other types of notifications to the user. Typically these messages are set by the event handlers and displayed by the layout pages. The framework provides the functionality to set and display these messages.
To set a message within the event handler use the setMessage() function. This function takes two arguments, a message type and a message text. The message type can take the following values: error, warning and info.
The file includes/message.cfm is responsible for displaying the messages. This file needs to be explicitly called from wherever you wish to display the message; usually this is done on the layout page. This file may be modified to display messages accordingly to the look and feel of the current application.
A particular thing to note on how system messages are handled is that these messages may be set and displayed on completely different HTTP requests. For example the browser may send a request to execute an action by calling the event: ehHandler.doSomething, and this event handler may decide that some error message needs to be displayed to the user, but instead of just setting the view, this event handler does a setNextEvent() to the event that prepares the view, effectively creating a separate HTTP request. Because of this, the messages created require special handling and cannot just be stored on the request scope. The way the framework solves this is by setting two in-memory cookies named message_type and message_text that are destroyed right after the system message is read and displayed.
