javax.faces.event
是 JavaServer Faces (JSF) 框架中的一个包,它包含了与事件处理相关的类和接口。JSF 是一个用于构建基于组件的用户界面的Java规范,而事件处理是其核心功能之一。通过这个包,开发者可以创建、监听和处理各种用户交互事件,如按钮点击、表单提交等。
以下是 javax.faces.event
包中一些重要的类和接口:
- ActionEvent:表示一个动作事件,通常由用户操作(如按钮点击)触发。
- ValueChangeEvent:表示一个值改变事件,当组件的值发生变化时触发。
- PhaseListener:允许在 JSF 生命周期的不同阶段插入自定义逻辑。
- SystemEvent:表示系统级别的事件,如视图创建或销毁。
- ComponentSystemEvent:特定于组件的系统事件。
- ExceptionQueuedEvent:表示在处理过程中发生的异常事件。
- FacesEvent:所有事件的基类,其他所有事件都继承自此类。
- BehaviorEvent:表示行为事件,通常与 Ajax 行为相关联。
这些类和接口为开发者提供了强大的工具来处理和管理用户界面中的事件,使得应用程序能够响应用户的交互并作出相应的反应。
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev Package
Next Package
Frames
No Frames
Package javax.faces.event
Interfaces describing events and event listeners, and concrete event implementation classes.
See: Description
Interface Summary Interface Description
ActionListener
A listener interface for receiving ActionEvents.
AjaxBehaviorListener
By implementing this class, an object indicates that it is a listener for one or more kinds of BehaviorEvents.
BehaviorListener
A generic base interface for event listeners for various types of BehaviorEvents.
ComponentSystemEventListener
Implementors of this class do not need an isListenerForSource() method because they are only installed on specific component instances, therefore the isListenerForSource() method is implicit.
FacesListener
A generic base interface for event listeners for various types of FacesEvents.
PhaseListener
An interface implemented by objects that wish to be notified at the beginning and ending of processing for each standard phase of the request processing lifecycle.
SystemEventListener
By implementing this class, an object indicates that it is a listener for one or more kinds of SystemEvents.
SystemEventListenerHolder
Classes that implement this interface agree to maintain a list of SystemEventListener instances for each kind of SystemEvent they can generate.
ValueChangeListener
A listener interface for receiving ValueChangeEvents.
ViewMapListener
Marker interface for SystemEvents that indicate the view map has been created (PostConstructViewMapEvent, or destroyed (PreDestroyViewMapEvent).
Class Summary Class Description
ActionEvent
An ActionEvent represents the activation of a user interface component (such as a UICommand).
ActionListenerWrapper
Provides a simple implementation of ActionListener that can be subclassed by developers wishing to provide specialized behavior to an existing ActionListener instance.
AjaxBehaviorEvent
AjaxBehaviorEvent represents the component behavior specific to Ajax).
BehaviorEvent
BehaviorEvent is the event that can be generated from component Behavior.
ComponentSystemEvent
ComponentSystemEvent is the base class for SystemEvents that are specific to a UIComponent instance.
ExceptionQueuedEvent
The system event facility will create an instance of this class whenever Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object) is called with ExceptionQueuedEvent.class as systemEventClass argument.
ExceptionQueuedEventContext
This helper class provides context to the ExceptionQueuedEvent regarding the state of the system at the point in time when the ExceptionQueuedEvent occurs and links the ExceptionQueuedEvent to the ExceptionHandler by virtue of implementing SystemEventListener.
FacesEvent
FacesEvent is the base class for user interface and application events that can be fired by UIComponents.
MethodExpressionActionListener
MethodExpressionActionListener is an ActionListener that wraps a MethodExpression.
MethodExpressionValueChangeListener
MethodExpressionValueChangeListener is a ValueChangeListener that wraps a MethodExpression.
PhaseEvent
PhaseEvent represents the beginning or ending of processing for a particular phase of the request processing lifecycle, for the request encapsulated by the specified FacesContext.
PhaseId
Typesafe enumeration of the legal values that may be returned by the getPhaseId() method of the FacesEvent interface.
PostAddToViewEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is a UIComponent instance and that either that instance or an ancestor of that instance was just added to the view.
PostConstructApplicationEvent
This event must be published by the runtime after all configuration resources have been parsed and processed.
PostConstructCustomScopeEvent
This class is provided to allow custom scopes to publish a "post construct" event in the same way that other scopes do to let the application become aware of the beginning of the scope.
PostConstructViewMapEvent
This event must be published by a call to {javax.faces.application.Application#publishEvent} when the view map is first created.
PostKeepFlashValueEvent
This event must be published by a call to Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object) when a value is kept in the flash.
PostPutFlashValueEvent
This event must be published by a call to Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object) when a value is stored in the flash.
PostRenderViewEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is the UIViewRoot instance that has just been rendered.
PostRestoreStateEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is in a tree that has just had its state restored.
PostValidateEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is the UIComponent instance that is that has just been validated.
PreClearFlashEvent
This event must be published by a call to Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object) before the flash is cleared.
PreDestroyApplicationEvent
This event must be published by the runtime before the factories associated with this Application are released.
PreDestroyCustomScopeEvent
This class is provided to allow custom scopes to publish a "pre construct" event in the same way that other scopes do to let the application become aware of the beginning of the scope.
PreDestroyViewMapEvent
This event must be published by a call to Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object) when the clear method is called on the map returned from UIViewRoot.getViewMap().
PreRemoveFlashValueEvent
This event must be published by a call to Application.publishEvent(javax.faces.context.FacesContext, java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Object) when a value is removed from the flash.
PreRemoveFromViewEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is a UIComponent instance that is about to be removed from the view.
PreRenderComponentEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is the UIComponent instance that is about to be rendered and that it is safe to call UIComponent.getParent(), UIComponent.getClientId(), and other methods that depend upon the component instance being in the view.
PreRenderViewEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is the UIViewRoot instance that is about to be rendered.
PreValidateEvent
When an instance of this event is passed to SystemEventListener.processEvent(javax.faces.event.SystemEvent) or ComponentSystemEventListener.processEvent(javax.faces.event.ComponentSystemEvent), the listener implementation may assume that the source of this event instance is the UIComponent instance that is about to be validated.
ScopeContext
A structure that contains the name of the scope and the scope itself exposed as a Map<String, Object>.
SystemEvent
SystemEvent is the base class for non-application specific events that can be fired by arbitrary objects.
ValueChangeEvent
A ValueChangeEvent is a notification that the local value of the source component has been change as a result of user interface activity.
WebsocketEvent
This web socket event will be fired when a new <f:websocket> has been @WebsocketEvent.Opened or @WebsocketEvent.Closed.
Exception Summary Exception Description
AbortProcessingException
An exception that may be thrown by event listeners to terminate the processing of the current event.
Annotation Types Summary Annotation Type Description
ListenerFor
Classes tagged with this annotation are installed as listeners using the method Application.subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent>, java.lang.Class<?>, javax.faces.event.SystemEventListener) or UIComponent.subscribeToEvent(java.lang.Class<? extends javax.faces.event.SystemEvent>, javax.faces.event.ComponentSystemEventListener) (depending on the circumstances, described below).
ListenersFor
Container annotation to specify multiple ListenerFor annotations on a single class.
NamedEvent
The presence of this annotation on a class automatically registers the class with the runtime as a ComponentSystemEvent for use with the <f:event /> tag in a page.
WebsocketEvent.Closed
Indicates that a <f:websocket> has closed.
WebsocketEvent.Opened
Indicates that a <f:websocket> has opened.
Package javax.faces.event Description
Interfaces describing events and event listeners, and concrete event implementation classes. All events extend from FacesEvent and all listeners extend from FacesListener.
For your convenience here is a UML class diagram of the classes in this package.
Skip navigation links
Overview
Package
Class
Use
Tree
Deprecated
Index
Help
Prev Package
Next Package
Frames
No Frames
Copyright © 1996-2017, Oracle and/or its affiliates. All Rights Reserved. Use is subject to license terms.