The methods in your handlers (actions) have always accepted the "event" object, which is the request context for that event and contains things like the request collection and private request collection.
A common handler method used to look like this:
function index(event) {
var rc = event.getCollection();
var prc = event.getCollection(private=true);
// Do Stuff
}
Remember, if you're using ColdBox 3.1 or higher, every action is now passed a reference to the request collection (rc) and private request collection (prc) as arguments so you don't have to get them yourself.
function index(event,rc,prc){
rc.foo = "Isn't this convenient?";
prc.bar = "Yes, yes it is.";
}
Remembering this tip can help clean up your code by omitting those uneccessary boilerplate lines of code to get the rc and prc.
More info here: http://wiki.coldbox.org/wiki/EventHandlers.cfm#Anatomy_of_an_Event_Handler_Action
Blog
Recent Entries
Be a rebel, but trust us on this: use ColdBox. You'll thank us later!
CFML developers have always had a bit of a rebellious streak.
That's part of what makes CFML great. It gives you enormous freedom to build applications quickly and structure them almost any way you want.
So yes, you can build a successful ColdFusion application without a framework. Many developers have, and some of those applications have been running for decades.
But trust us on this one:
Use a framework.
And if you're building or maintaini...
BoxLang AI 3.4.0: Gateways, Human-in-the-Loop, and a Full Security Stack
BoxLang AI 3.4.0 is one of the biggest releases in the module's history, and it is built around a single theme: trust. Every agent you ship eventually needs a human to step in, and every agent that reads untrusted content is a target for prompt injection. This release gives you both a proper answer.
Add Your Comment