May 2019
Intermediate to advanced
546 pages
12h 41m
English
Setter methods pass values from the page to a controller, for example, the values of an input field. Any setter method in a controller is automatically executed before any action methods. The setter method has the same naming convention as the getter method, except set (to set a value in your property) is used instead of get (to return the data from your property). The name of the method should start with set and the name of the variable.
In the following code, we will set a search value:
private String searchString;public void setSearchString(String sMovie){ this.searchString = sMovie;}
To set the variable in the page, we define an input field with the value of the searchMovie variable:
<apex:inputText id={!search}" value="{!searchString}" ...Read now
Unlock full access