f:setPropertyActionListener makes it easier to do a common task in JSF application development: set a value when executing an UICommand.

General Usage

To set the target UIComponent implementing ActionSource, use for attribute (this can be avoided if nested to another UICommand Facelet element). For specifying the bean value to be set, use target attribute, and use value for getting the same that will be used into target. This Facelet will then add a new dynamic ActionListener to the parent component (or the one set in forattribute). This ActionListener will set the target value obtained from value expression.


Source Code

<ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://xmlns.jcp.org/jsf/core"
	xmlns:h="http://xmlns.jcp.org/jsf/html"	xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

		<h:commandButton value="#{i18n['submit']}">
			<f:setPropertyActionListener target="#{setPropertyActionListenerBackingBean.targetText}" 
			value="Source Text"/>
			<f:ajax execute="@form" render="@form"/>
		<h:outputText value="#{setPropertyActionListenerBackingBean.targetText}"/>

public class SetPropertyActionListenerBackingBean {

	private String targetText;

	public String getTargetText() {
		return targetText;

	public void setTargetText(String targetText) {
		this.targetText = targetText;

Liferay Faces Bridge Implementation 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20