RemoteCommand

RemoteCommand enables executing backing bean methods and do partial update triggered by custom client side script. This example demonstrates a use case where a certain part of a page can be lazily loaded on demand.

Source

 <h:form id="form">
                	
	<p:commandButton value="Load" type="button" onclick="lazyload()" id="btnLoad" />
        	                	
    <p:outputPanel id="lazypanel" layout="block">
    	<h:outputText value="This part of page is lazily loaded on demand using a RemoteCommand" 
    			rendered="#{requestScope.shouldRender}"/>
    </p:outputPanel>
        	
	<p:remoteCommand name="lazyload" update="lazypanel">
		<f:setPropertyActionListener value="#{true}" 
    		target="#{requestScope.shouldRender}" />
	</p:remoteCommand>
            
</h:form>