Tag Archives: action

Dealing with f:setPropertyActionListener and actionListener in JSF

One important thing about f:setPropertyActionListener tag.
ActionListeners will executes in order they defined!

For ex. see next code.
On page:

 <p:commandLink actionListener="#{SomeBean.onSomeAction}" ajax="true">
        target="#{SomeBean.someProperty}" value="SOME_NEW_VALUE !!!" />
    <h:outputText value="Here is some text..." />

JSF Bean:

public class SomeBean implements Serializable {
    private String someProperty;

    public void onSomeAction(ActionEvent event) {
        System.out.println("SomeBean.onSomeAction() fired!");

	public String getSomeProperty() {
        return someProperty;

    public void setSelectedProperty(String someProperty) {
	    System.out.println("SomeBean.setSomeProperty() fired!");
        this.someProperty = someProperty;

So, be aware of situation when your property will set after command action listener fired.

The output:

  SomeBean.onSomeAction() fired!
  SomeBean.setSomeProperty() fired!

To solve the issue, you have to use action instead of actionListener.
That’s all.

Also, see http://stackoverflow.com/a/14160010