Class UpdateActionListener

  extended by org.apache.myfaces.custom.updateactionlistener.UpdateActionListener
All Implemented Interfaces:
java.util.EventListener, javax.faces.component.StateHolder, javax.faces.component.ValueHolder, javax.faces.event.ActionListener, javax.faces.event.FacesListener

public class UpdateActionListener
extends java.lang.Object
implements javax.faces.event.ActionListener, javax.faces.component.ValueHolder, javax.faces.component.StateHolder

Set an arbitrary property on a managed bean when an "action" component is selected by the user.

An instance of this listener type can be attached to any UIComponent which is an ActionSource (eg a link or button). When the associated component fires its action event, this listener will read the value specified by attribute "value" and assign it to the property specified by attribute "property". The value attribute may be a literal value or may be a value-binding; the property is always expected to be a value-binding.

An optional Converter may be associated with this listener, and if present will be invoked to convert the value to the datatype expected by the target property. When no converter is available, a default one will be retrieved from the Application object.

A common use for this listener is to attach it to an HtmlCommandLink component, storing some constant value into a managed bean property. After the navigation associated with that link is done, components in the new view can look at that property to determine which link was clicked.

Both the fetching of "value" and the updating of "property" occur in the invoke-application phase unless "immediate" is set on the ActionSource component in which case they both occur in the apply-request-values phase. The update is guaranteed to occur before the invocation of the method specified by attribute "action" on the ActionSource (because all actionListeners are executed before the action attribute).

JSF 1.2 introduces a "setPropertyActionListener" with the same functionality like this.

$Revision: 472638 $ $Date: 2006-11-08 15:54:13 -0500 (miƩ, 08 nov 2006) $
Manfred Geiler (latest modification by $Author: grantsmith $)

Constructor Summary
Method Summary
 javax.faces.convert.Converter getConverter()
 java.lang.Object getLocalValue()
 javax.faces.el.ValueBinding getPropertyBinding()
 java.lang.Object getValue()
 javax.faces.el.ValueBinding getValueBinding()
 boolean isTransient()
 void processAction(javax.faces.event.ActionEvent actionEvent)
 void restoreState(javax.faces.context.FacesContext context, java.lang.Object state)
 java.lang.Object saveState(javax.faces.context.FacesContext context)
 void setConverter(javax.faces.convert.Converter converter)
 void setPropertyBinding(javax.faces.el.ValueBinding propertyBinding)
 void setTransient(boolean newTransientValue)
 void setValue(java.lang.Object value)
 void setValueBinding(javax.faces.el.ValueBinding valueBinding)
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public UpdateActionListener()
Method Detail


public void setPropertyBinding(javax.faces.el.ValueBinding propertyBinding)


public javax.faces.el.ValueBinding getPropertyBinding()


public void setValue(java.lang.Object value)
Specified by:
setValue in interface javax.faces.component.ValueHolder


public java.lang.Object getValue()
Specified by:
getValue in interface javax.faces.component.ValueHolder


public java.lang.Object getLocalValue()
Specified by:
getLocalValue in interface javax.faces.component.ValueHolder


public javax.faces.el.ValueBinding getValueBinding()


public void setValueBinding(javax.faces.el.ValueBinding valueBinding)


public javax.faces.convert.Converter getConverter()
Specified by:
getConverter in interface javax.faces.component.ValueHolder


public void setConverter(javax.faces.convert.Converter converter)
Specified by:
setConverter in interface javax.faces.component.ValueHolder


public void processAction(javax.faces.event.ActionEvent actionEvent)
                   throws javax.faces.event.AbortProcessingException
Specified by:
processAction in interface javax.faces.event.ActionListener


public java.lang.Object saveState(javax.faces.context.FacesContext context)
Specified by:
saveState in interface javax.faces.component.StateHolder


public void restoreState(javax.faces.context.FacesContext context,
                         java.lang.Object state)
Specified by:
restoreState in interface javax.faces.component.StateHolder


public boolean isTransient()
Specified by:
isTransient in interface javax.faces.component.StateHolder


public void setTransient(boolean newTransientValue)
Specified by:
setTransient in interface javax.faces.component.StateHolder

Copyright © 2011 The Apache Software Foundation. All Rights Reserved.