+ Start a Discussion
AnjaneyluAnjaneylu 

setter and getter methods

hi,
i am new to salesforce, i want to know the set and get method ...
what would happen when we declare the variables like this..
please kindly help me.. please.........

public Cat3__c cat {get;set;}
public String message {get;set;}

 
Ravikant kediaRavikant kedia
Setter and getter method are used to set and get value from viual force page.
Like
Setter Methods:
<apex:inputText value= "{!message }"  />
Then when you enter value inside it then it will automaticaly set in controller message like in your public String message {get;set;} 

Getter Method;
When you declare value like message = 'test'; In your constructor or elsewhere in your controller then visualforce page auomaticaly get the value of message.

<apex:outputText value= "{!message }" /> 
NagaNaga (Salesforce Developers) 
Hi Anji Reddy,

Please follow the below link for more info on 

http://blog.jeffdouglas.com/2009/01/13/apex-search-with-checkbox-results/
http://blog.jeffdouglas.com/2011/01/17/passing-values-to-javascript-from-apex-controller-method/

Please let me know if this helps you.

Best Regards
Naga Kiran