Skip to main content
edited tags
Link
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431
Source Link
John_Henry
  • 931
  • 4
  • 13
  • 39

Accessing Variable from Controller in Another Apex Class

I have a variable, that is set in a method of an Apex class that is set as the controller of a custom VF page:

public without sharing class HomeController{
  public HomeController(){
    init();
  }
  public List<People__c> people;
  public void init(){
    people = [my soql]
  }
}

I now want to access this people variable in another Apex class - caveat being that this Apex class is the controller for a VF Component that is loaded through the Template of the same VF page. How would I go about doing this?