function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Srinu SomuSrinu Somu 

Visualforce get request sequence?

Reference: Visualforce Developer guide
The constructor methods on the associated custom controller or controller extension classes are called, instantiating the controller objects.
The action attribute on the <apex:page> component is evaluated, and all other method calls, such as getting or setting a property value, are made.

But in some blogs I am seeing the order as constructor, getter methods and page action method respectively.

But from the Visualforce developer guide it should be constructon, page action method and getter methods respectively.

Please help me with my confusion?
Best Answer chosen by Srinu Somu
Jigar.LakhaniJigar.Lakhani
Hello,

Correct sequence is Constructor, Pag Action Method and Getter Setter Property. Visualforce Developer Guide is correct.

Visualforce Page:
<apex:page controller="ExecutionSequence" action="{!pageActionMethod}">
    {!PropertyMethod}
    <!-- Begin Default Content REMOVE THIS -->
    <h1>Congratulations</h1>
    This is your new Page
    <!-- End Default Content REMOVE THIS -->
</apex:page>

Apex Class:
Public Class ExecutionSequence{
    
    // Constructor
    Public ExecutionSequence(){
        System.debug('##################  Constructor');
    }
    
    // Getter Setter Property
    Public Void getPropertyMethod(){
        System.debug('##################  Getter Setter Method');
    } 
    
    // Page Action Method
    Public PageReference pageActionMethod(){
        System.debug('##################  Page Action Method');
        return null;
    }
    
}

User-added image

Thanks and Cheers,
Jigar