apex:actionPollar tag in visualforce page





actionpoller tag in salesforce


actionPoller

What is actionPoller tag? This tag specifies a timer that sends an AJAX update request at specified interval. Minimum interval time to refresh is 5 sec.
Here in this post i am providing a simple example to explain about actionPoller.  I am calling a simple method from controller to display Date & TIme and recalling that method by using actionPoller tag to change the time for every 5 sesc. See the below code to understand how actionPoller will work.
Visualforce page Code:
<apex:page controller="actionpollerDemoController">
    <apex:form >
        <apex:pageBlock id="pb">
             <apex:actionPoller action="{!dateTimeMethod}" reRender="pb" interval="5"/>
                     Hello!!!  Date and Time: {!dateAndTime} 
                     <p>Note: Time will refresh fror eevry 5 sec.</p>
         </apex:pageBlock>
      </apex:form>
</apex:page>
Apex Controller:
Public with sharing class actionpollerDemoController {
Public DateTime dateAndTime{get;set;}
Public void dateTimeMethod(){
dateAndTime = System.now();
}
}
OutPut: In below screen rounded part will refresh for every 5 secs

Post a Comment

MKRdezign

Contact Form

Name

Email *

Message *

Powered by Blogger.
Javascript DisablePlease Enable Javascript To See All Widget