Search code examples
jsfjsf-2primefaces

Why we use setPropertyActionListener in JSF?


I am working with JSF and Primefaces. I used setPropertyActionListener from a JSF demo example. It is working, but I don't understand the specific purpose of it.

<p:commandButton value="Search" ajax="false" 
  action="#{scmAirLiftApprovalRequestManager.search}">
   <f:setPropertyActionListener value="true" 
     target="#{scmAirLiftApprovalRequestManager.isSearching}" />
</p:commandButton>

Can anyone explain in simple what actually it doing?


Solution

  • <f:setPropertyActionListener> sets directly a property in the managed bean.

    In the provided snippet of yours, the #{scmAirLiftApprovalRequestManager.isSearching} property will be set to true when the <p:commandButton>'s action is invoked.

    More info: