How to call managed bean' s method using Primefaces

05 March 2016 on Java.

Hello everyone, If you would like to call managed bean’ s method from javascript, Primefaces p:remoteCommand is exactly what you are looking for.

<p:remoteCommand name="myCustomFunction" actionListener="#{bean.method}" />

this command generate following javascript code:

<p:commandLink id="commandLink" actionListener="#{bean.method}" onclick="myCustomFunction"/>