Ex:1
Visualforce Page:
<apex:page controller="actionsupportcls">
<apex:form >
<apex:outputpanel id="counter">
<apex:outputText value="Click Me!: {!count}"/>
<apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="counter"/>
</apex:outputpanel>
<apex:outputPanel id="out">
<apex:outputLabel >{!name}</apex:outputLabel>
<apex:actionPoller action="{!change}" interval="5" reRender="out"/>
</apex:outputPanel>
</apex:form>
</apex:page>
Apex Class:
public with sharing class actionsupportcls {
public PageReference change() {
name='ctrla technologies';
return null;
}
public String name { get; set; }
Integer count = 0;
public PageReference incrementCounter() {
count++;
return null;
}
public actionsupportcls(){
name='ctrla';
}
public Integer getCount() {
return count;
}
}
Ex:2
Visualforce Page:
<apex:page controller="funcls" >
<apex:form id="form" >
<apex:actionFunction name="showrec" action="{!show}" />
<apex:pageBlock id="pb" >
<apex:commandButton value="Show" onclick="showrec()" reRender="pb"/>
<apex:outputlabel >{!name}</apex:outputlabel>
</apex:pageBlock>
<apex:actionPoller action="{!show}" interval="10" rerender="pb"/>
</apex:form>
</apex:page>
Apex Class:
public with sharing class funcls {
public String name { get; set; }
public PageReference show() {
System.debug('---------->Method is calles');
name='ctrla Technologies';
return null;
}
public funcls(){
name='Ctrla';
}
}
Visualforce Page:
<apex:page controller="actionsupportcls">
<apex:form >
<apex:outputpanel id="counter">
<apex:outputText value="Click Me!: {!count}"/>
<apex:actionSupport event="onclick" action="{!incrementCounter}" rerender="counter"/>
</apex:outputpanel>
<apex:outputPanel id="out">
<apex:outputLabel >{!name}</apex:outputLabel>
<apex:actionPoller action="{!change}" interval="5" reRender="out"/>
</apex:outputPanel>
</apex:form>
</apex:page>
Apex Class:
public with sharing class actionsupportcls {
public PageReference change() {
name='ctrla technologies';
return null;
}
public String name { get; set; }
Integer count = 0;
public PageReference incrementCounter() {
count++;
return null;
}
public actionsupportcls(){
name='ctrla';
}
public Integer getCount() {
return count;
}
}
Ex:2
Visualforce Page:
<apex:page controller="funcls" >
<apex:form id="form" >
<apex:actionFunction name="showrec" action="{!show}" />
<apex:pageBlock id="pb" >
<apex:commandButton value="Show" onclick="showrec()" reRender="pb"/>
<apex:outputlabel >{!name}</apex:outputlabel>
</apex:pageBlock>
<apex:actionPoller action="{!show}" interval="10" rerender="pb"/>
</apex:form>
</apex:page>
Apex Class:
public with sharing class funcls {
public String name { get; set; }
public PageReference show() {
System.debug('---------->Method is calles');
name='ctrla Technologies';
return null;
}
public funcls(){
name='Ctrla';
}
}
No comments:
Post a Comment