I have a VisualForce page testPage
<apex:page controller="testController">
{!myString}, {!myString1}, {!myString2}, {!Mystring3}, {!myString}
</apex:page>
And the controller is
public class testController {
public string myString {get;set;}
public string getMyString1()
{
return myString;
}
public string getMyString2()
{
if(myString==null)
myString = 'Method2';
return myString;
}
public void getMystring3()
{
myString = 'Method3';
}
}
When loading the page, it outputs , , Method2, ,
.
The methods getMyString2 and getMystring3 both set the property.
Why the myString
property is not set here?