The Event Declaration builder adds a <declaration />
element to the _EventDeclarations
variable and adds a fireEventName
method to the WebApp.
Other methods in your model can call the fire EventName
method for any user-defined events when a particular action occurs or when some condition exists. You add an Event Handler builder call to your model for each Event Declaration builder call.
You can use this builder to fire events within the context of a portal or of a mashup. Events fired by this builder share session data and can be handled within the context of the portal or of the mashup, providing all models that communicate by these events are contained within the same WAR file.
When you use IBM® WebSphere® Portlet Factory events fired by this builder in a portal or in a mashup, do not fire events on the initial load of the model. In a portal setting or a mashup setting, you cannot guarantee the order in which portlets or widgets are loaded, so the target models may have not been instantiated yet. Also, do not make direct access to the session or request objects. These objects are related to the event originator.
You can also use the Event Declaration and Event Handler builders when you want to establish communication between applications using simple broadcast events.
It is a good idea to keep event declarations, event handlers, and related actions organized with a naming convention. Use some name format for the builder call names, for example, MyEventDeclaration, MyEventHandler, and MyEventAction. Doing so allows you to identify the Event Handler builder for a particular Event Declaration builder and distinguishes methods that handle events from the other methods in your model.
Parent topic: Builder help
About using the builder call editor
Event Handler builder
About firing events
About handling events