Professional Documents
Culture Documents
Visualforce-Session2-Getter and Setters
Visualforce-Session2-Getter and Setters
Setter method : This method is used to read the value from the Vf page and store
the value
to a variable in apex class
Ex : Integer age ;
this.name=name;
}
Getter Method : This method is used to read the value from the apex class and
return the
2. when ever we give an expression {! var } it call the getter method of the
var
Example :
Apex class:
<apex:page controller="GetterExample">
Name : {! name } <br/>
Age : {! age } <br/>
Branch: {!branch}
</apex:page>
===> In case if we want to simply return the values that are stored in the class
variables then
use standard format of getter and setter
Example :
Apex Class Name :GetsetExample
}
VF Page:
<apex:page controller="GetSetExample">
Name : {!name} <br/>
Age : {!age}
</apex:page>
===================================================================================
===========
ApexClass :SectionHeaderExample
VF Page:
<apex:page controller="SectionHeaderExample">
<apex:sectionHeader title="{!title}" subtitle="{!subTitle}" description="{!
description}" />
</apex:page>
===================================================================================
=============