Portlet Factory, Version 6.1.2


 

Event Handler builder

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.

Portlet_WindowClosed_Event

Portlet_WindowClosing_Event

Portlet_WindowMaximized_Event

Portlet_GetTitle_Event

For a portlet that uses the WebSphere native (deprecated) API, these portlet events are generated when a Portlet Adapter builder is added to the model.

The Portlet_GetTitle_Event is fired in a portlet that uses the Java Standard 1.0 or Java Standard 2.0 API, but is not supported in IBM WebSphere Portal server.

 

More about WebApp events

Order in which WebApp events occur in an application

  1. OnWebAppLoad

  2. OnRequest

  3. OnUnHandledError (optional and ideally never fired!)

  4. OnPageLoad

  5. OnRequestComplete

Keep event declarations, event handlers, and related actions organized with a naming convention

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.

Parent topic: Builder help Parent topic: Enabling Click-to-Action


Library | Support |