Class UIViewAction

All Implemented Interfaces:
ActionSource, ActionSource2, PartialStateHolder, StateHolder, TransientStateHolder, ComponentSystemEventListener, FacesListener, SystemEventListenerHolder, EventListener

public class UIViewAction
extends UIComponentBase
implements ActionSource2

UIViewAction represents a method invocation that occurs during the request processing lifecycle, usually in response to an initial request, as opposed to a postback.

The ViewDeclarationLanguage implementation must cause an instance of this component to be placed in the view for each occurrence of an <f:viewAction /> element placed inside of an <f:metadata /> element. The user must place <f:metadata /> as a direct child of the UIViewRoot.

Because this class implements ActionSource2, any actions that one would normally take on a component that implements ActionSource2, such as UICommand, are valid for instances of this class. Instances of this class participate in the regular Jakarta Server Faces lifecycle, including on Ajax requests.

The purpose of this component is to provide a light-weight front-controller solution for executing code upon the loading of a Jakarta Server Faces view to support the integration of system services, content retrieval, view management, and navigation. This functionality is especially useful for non-faces (initial) requests.

The most common use case for this component is to take actions necessary for a particular view, often with the help of one or more UIViewParameters.

The NavigationHandler is consulted after the action is invoked to carry out the navigation case that matches the action signature and outcome. If a navigation case is matched that causes the new viewId to be different from the current viewId, the runtime must force a redirect to that matched navigation case with different viewId, regardless of whether or not the matched navigation case with different viewId called for a redirect. If the navigation will result in a flow transition, the appropriate metadata must be included in the query string for the redirect. See section 7.4.2 Default NavigationHandler Algorithm, for the discussion of how to handle &lt;redirect /&gt; cases.

It's important to note that the full component tree is not built before the UIViewAction components are processed on an non-faces (initial) request. Rather, the component tree only contains the ViewMetadata, an important part of the optimization of this component and what sets it apart from a PreRenderViewEvent listener.

Since:
2.2