f:event

It's possible to attach event listeners to UIComponent events, like preRenderComponent or preRenderView in f:event.

General Usage

Just implement a method passing a ComponentSystemEvent parameter and it will be invoked whenever that event occurs. To see the possible values of type, just see f:event VDL.

Component with id inputTextComponentEventId generated an event.
Component with id outputTextcomponentEventId generated an event.

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:inputText id="inputTextComponentEventId" value="#{inputTextModelBean.text}">
		<f:event listener="#{eventBackingBean.preRenderComponent}" type="preRenderComponent"/>
	</h:inputText>
	<br/>
	<h:outputText id="outputTextcomponentEventId" value="#{eventBackingBean.text}" escape="false">
		<f:event listener="#{eventBackingBean.preRenderComponent}" type="preRenderComponent"/>
	</h:outputText>

</ui:composition>
@ManagedBean
@RequestScoped
public class EventBackingBean {

	private StringBuilder text = new StringBuilder();

	public String getText() {
		return text.toString();
	}

	public void preRenderComponent(ComponentSystemEvent event) throws AbortProcessingException {
		text.append("Component with id " + event.getComponent().getId() + " generated an event.<br/>");
	}
}
Liferay Faces Bridge Implementation 5.0.0 + Liferay Faces Portal 5.0.0 + Showcase Common 3.1.1 + Liferay Faces Util 3.4.1 + Mojarra 2.2.20