The Event Handler builder lets you specify an action to perform when a specified event occurs.

The Event Handler builder lets you specify an action to perform when a specified event occurs.

Use an Event Handler builder to handle any one of the WebApp events (see WebApp events ) or events that you declare with an Event Declaration builder. For more information about the events and event handling, see More about WebApp events .

WebApp events

OnWebAppLoad

Automatically fired when the WebApp main method or action executes.
The OnWebAppLoad event is fired when a WebApp is loaded. This is triggered by the first request to the WebApp, usually the first time that WebApp instance is loaded for that user or session.

OnRequest

The OnRequest and OnRequestComplete events are fired on every subsequent request to the WebApp, each time the end-user performs any action at the browser which causes a new request to the server, usually an HTTP request. The OnRequest event is usually at the beginning of each request to that WebApp. The OnRequestComplete event is fired at the end of every request to the server.
An OnRequest handler fires in both the ActionRequest and RenderRequest for portlets because the portal is sending both types of requests. In an environment where a portlet is in running in an IBM® WebSphere® Portal server, each request from the browser is broken up into an action request and a render request. The action request is directed only to the single portlet that is receiving the action. That portlet has the OnRequest and OnRequestComplete events fired before and after the action request. All portlets that are on the current page, including the one that received the action, get the render request to render their page again and see the OnRequest and OnRequestComplete events fired.

OnRequestComplete

Fires at the end of each request.
For a portlet, the event is delivered to the portlet model.

For a standalone application, the event is delivered to the top-level model.

For a widget, the event is delivered to the widget model handling that request.

OnUnHandledError

Automatically fired for errors that occur that are not handled by an Error Handler builder call
The OnUnHandledError event is fired when an unhandled error is encountered. For example, this case might arise at the end of a model action if there was an exception that is not caught by an action or method, and the exception makes its way up to the WebSphere Portlet Factory controller WebApp runner level.

OnPageLoad

Automatically fired when a page in the model is displayed (one event of this type for each page in the model )
The OnPageLoad event is fired when a page is loaded. For example, when a page in the application is rendered, this event is fired.

ModelContainerPreLoad

Fired by the Model Container builder runtime, just before it loads a new model into a container.

Use some naming convention such as MyEventDeclaration, MyEventHandler, and MyEventAction for the builder call names. Doing so allows you to identify the event handler for a particular event declaration and distinguishes methods that handle events from the other methods in your model.

DataPage can add the Form Submit Event in certain circumstances

When Data Page is managing an input form, it adds a special input, Form Submit Event, to the form. When the form is submitted, the presence of this special input causes this form submit event to be fired. This is caught by the page automation runtime, which in response runs code to copy the form data into the associated variable.