First page Back Continue Last page Text

oracle adf workshop


Responding to Action Events

Action events are events that are associated with command components (such as commandButton, commandLink, or commandMenuItem).

An action event enables you to define an action method that returns an outcome to be used for navigation. Instead of entering a control flow outcome directly in the action property of a command component, you refer to a bean method that returns a string that corresponds to the control flow outcome. An example is shown in the next slide.

Action method code can be either in the page-backing bean or in a separate class. The benefit of having the code in the backing bean is that the code that is associated with a specific page is all local to the page (single source). However, the benefit of a separate class is reusability. For example, if you have standard code that should be executed regardless of the page, then the separate class approach makes more sense. If you use the backing bean approach, JDeveloper creates a method stub for you; all you have to do is add your custom code. JDeveloper also registers the action in the page source.

When the page is submitted, the action method is added to the queue of application events to be executed. Action methods are the last to fire in the application phase of the life cycle. For this reason they are generally used to determine navigation.