Getter methods return values from a controller. Every value that is calculated by a controller and displayed in a page must have a corresponding getter method, including any Boolean variables. in other simple words The "get" method is used to pass data from your Apex code to your Visualforce page
Setter Methods:
Setter methods pass user-specified values from page markup to a controller. Any setter methods in a controller are automatically executed before any action methods. In other simple words The "set" method is used to pass values from your visualforce page to the controller
For Example in below scenerio userinput will display "Sample Text" as output.
public class getsetTest
{
public String userinput;
public String getuserinput()
{
return 'Sample Text';
}
public void setuserinput(String userinput)
{
this.userinput = userinput;
}
}
<apex:page controller="getsetTest">
<apex:form>
<apex:outputpanel id="display">
<apex:outputtext value="The name entered is {!userinput}"/>
</apex:outputpanel>
</apex:form>
</apex:page>
Getter Methods:
Getter methods return values from a controller. Every value that is calculated by a controller and displayed in a page must have a corresponding getter method, including any Boolean variables. in other simple words The "get" method is used to pass data from your Apex code to your Visualforce page
Setter Methods:
Setter methods pass user-specified values from page markup to a controller. Any setter methods in a controller are automatically executed before any action methods. In other simple words The "set" method is used to pass values from your visualforce page to the controller
For Example in below scenerio userinput will display "Sample Text" as output.
Make sense ?