javax.faces.application
Class Action

java.lang.Object
  extended byjavax.faces.application.Action

public abstract class Action
extends java.lang.Object

An Action is an object that performs a task, and returns a String value that describes the result of performing that task. Actions are typically invoked via UIComponents that have an actionRef attribute, when that component is activated by the user.

An object that implements Action is typically made available for use by JavaServer Faces components by exposing a read-only JavaBeans property that returns an Action instance, often implemented as an anonymous inner class. For example:

   public class MyNavigationHandler {
     ...
     public Action getMenuPickAction() {
       return new Action() {
         public String invoke() { return (doMenuPick()); }
       }
     }
     ...
     public String doMenuPick() {
       ... actual behavior goes here ...
     }
     ...
   }
 

Using this technique, an application object can expose behavior both directly to other application objects (the public doMenuPick() method) and indirectly to JavaServer Faces components who might access it via an actionRef property value like "handler.menuPickAction".

If needed, an Action can gain access to state information about the current JavaServer Faces request by calling the static method FacesContext.getCurrentInstance().


Constructor Summary
Action()
           
 
Method Summary
abstract  java.lang.String invoke()
          Perform the task that is encapsulated in this Action instance, and return a String value that is a logical description of the outcome of performing that task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Action

public Action()
Method Detail

invoke

public abstract java.lang.String invoke()

Perform the task that is encapsulated in this Action instance, and return a String value that is a logical description of the outcome of performing that task. Exceptions encountered during the performance of the task should be encapsulated into appropriate return values.