Your model can use events to trap and process different types of occurrences in the web application or widget.
Your model can process the following types of events:
- System events
- User events
- Declared events
- Widget events
When firing an event, your model can send data and can broadcast that a particular action has occurred.
All models support the following predefined system events:
Fired each time a new instance of the model WebApp is instantiated for a session.System: OnRequest
Fired each time an external request is made (typically, from a browser) to the WebApp. System: OnUnhandledError
Fired when an error occurs and is not handled by an explicit error handler.Page:pageName:OnPageLoad
Fired each time the specified page is requested. Each page in the model gets its own OnPageLoad event declaration.
To process any of these events, add an Event Handler builder to the model and specify the action to perform when the event occurs.
As the user interacts with the HTML controls of your application, you can process those events with the HTML Event Action builder. This builder monitors a specified HTML control (added to the page by another builder) and performs an action when the specified event occurs. For example, to submit a form when the user clicks on a link, use the HTML Event Action builder call.
You can declare application-specific events by adding an Event Declaration builder to a model. The Event Declaration builder adds a fireEventName
method to the model that allows you to fire the event. Any models that have an identical Event Declaration builder call (either added directly or indirectly with an imported model) can handle that event.
A Widget event is a special event that is handled by widgets in IBM® Lotus® Mashups. Create widget events using the Widget Event builder.
Parent topic: Developing Web applications with IBM WebSphere Portlet Factory
Using widget events