Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

How are events called?

ColdBox determines events via the event variable using module:package.handler.action syntax, defaulting to main.index.

Events are determined via a special variable that can be sent in via the FORM, URL, or REMOTELY called event. If no event is detected as an incoming variable, the framework will look in the configuration directives for the DefaultEvent and use that instead. If you did not set a DefaultEvent setting then the framework will use the following convention for you: main.index

Please note that ColdBox supports both normal variable routing and URL mapping routing, usually referred to as pretty URLs.

Event Syntax

In order to call them you will use the following event syntax notation format:

  • no event : Default event by convention is main.index

  • event={handler} : Default action method by convention is index()

  • event={handler}.{action} : Explicit handler + action method

  • event={package}.{handler}.{action} : Packaged notation

  • event={module}:{package}.{handler}.{action} : Module Notation (See ColdBox Modules)

This looks very similar to a Java or class method call, example: String.getLength(), but without the parentheses. Once the event variable is set and detected by the framework, the framework will tokenize the event string to retrieve the class and action call to validate it against the internal registry of registered events. It then continues to instantiate the event handler class or retrieve it from cache, finally executing the event handler's action method.

Examples

Last updated

Was this helpful?