Visual-force Order of Execution
Visual-force Order of Execution are divided in two parts, namely Get and Post Back request.
We will see both of the one by one.
We will see both of the one by one.
Get Request
- Firstly, the constructor's are called from the associated Controller or extension classes.
- Secondly, constructor's from the Custom component controller or extensions are called.
- In this step the expressions are evaluated on the custom component
- Attribute like assignTo are evaluated along with action methods and once the action methods are finished all other methods are evaluated on the Custom Components.
- In this step, view state is maintained. This is important to maintain necessary information between Database and Page.
- The resulting HTML is sent to the browser. If there are any client-side technologies on the page, such as JavaScript, the browser executes them.
Post Back Request
- In Post Back Request, firstly the View state is maintained to update the values on controller side (This doesn't work in case of Immediate = true i.e. action executed but no validation is fired.)
- Secondly, all the expressions are evaluated and methods on the controller side also the one which are a part of Custom components. No values are update until all the methods are evaluated. For example, if one of the methods updates a property and the update is not valid due to validation rules or an incorrect data type, the data is not updated and the page re-displays with the appropriate error messages.
- Now, Post Back Action is executed and update the view state if Action completes successfully. (Apex:Page action method is executed at the time of Get request)
- Lastly, the Post Back request returns the result and displayed on the page. I.e. if the post-back request results in redirection of page the it will evaluate otherwise the Get method is called again to refresh the properties.
Please refer this link for more details: VF page developer guide
Please share your view
~Gaurav Garg~
Be Motivated Keep Learning
Comments