Skip to main content
2 of 5
added 437 characters in body
Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431

If you want to declare a setter, you must set the property equal to the incoming value.

public String userInput
{
    get { return userInput; }
    set { userInput = value; }
}

You can also use the simplified form here since you are not doing anything more fancy:

public String userInput { get; set; }

@sfdcfox has astutely pointed you towards Building a Custom Controller from the Visualforce Developer Guide, but I think his own explanation is actually a better read for you here: Apex Controllers: What do the get; set; do?

Adrian Larson
  • 151.3k
  • 38
  • 247
  • 431