An event is a specific operation that is executed for a specific command. When a command on a web page triggers an event, an event handler performs the work. An event is typically executed by a button or link in a web page. Oracle ADF provides an easy way to build commands and event handlers for working with events in your web applications. For example, you can:
Note: Both UIX and the Oracle ADF data action classes use events. When UIX and these classes are used together, either UIX or Struts will handle the event parameter. For more information see About Event Handling in Applications Using Oracle ADF, UIX, and Struts
Oracle ADF provides ways to handle two types of events:
The ADF controller calls model-layer operations using action bindings.
When the controller layer needs to execute an event, it finds the
corresponding action binding and invokes the doIt()
method
on the binding. Each binding has a default event handler that executes
the default behavior defined in the action binding.
You can develop your own named events to be called by the data action or data page in your application by writing an event handler for the event. For example, you can override an existing action binding by subclassing the associated data action or data forward action class.
You can also create events that are independent of the model layer; that is, the data action does not need to call an action binding to perform the operation. For example, you can use a named event to perform calculations, such as giving a subtotal for items in a shopping cart. You can also create custom navigation options, such as a help button in your web pages that takes the user to a help page for a particular part of your web application.
At runtime the data action looks for a custom event handler first. If there is no custom event handler, the data action calls the action binding for the operation. For example, most data collections provide a Next method, which displays the next page of records in a set of query results. If you override the Next method by adding an event handler for it in the data action, the data action runs the custom event handler for the Next method. If there is no custom handler, the data action executes the action binding associated with the Next event.
Note: For Model 1 applications, you subclass the lifecycle class to create the event handler.
You can also use an event to define the forward for an action in a web page by making the forward name for the action identical to the event name in the associated web page.
For information about creating named events in Oracle ADF, see Working with Named Events in Oracle ADF.
Working with Named
Events in Oracle ADF
About the Oracle ADF Lifecycle
Customizing the Oracle ADF Lifecycle
Copyright © 1997, 2004, Oracle. All rights reserved.