Thursday, April 15, 2010

ColdMVC: Params Scope and Flash Scope

In addition to the standard ColdFusion scopes, ColdMVC “adds” two additional scopes to your application: params and flash. This is possible by leveraging ColdFusion’s getPageContext().getFusionContext().hiddenScope variable.

The params scope will contain all FORM and URL variables, as well as any parameters created by the current request’s route. All variables within the params scope are automatically copied into the variables scope of views and layouts for quicker reference.

The flash scope is a slightly temporary scope. Any data put into the flash scope lasts for the life of the current request, and is then copied into the params scope of the next request. This is useful for displaying one-time status messages to the end user when records are successfully added, edited, or deleted.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.