Order of executetion in VF page 1) Constructor of controller /extension - > 2) constructor of custom components -> 3) AssignTo any Custom Components -> 4) Action method 5) Getter or Setter 6) Form method -> HTML
So After constructor you are good to go with Action method. 1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm ApexPages.Action The action method invoked when this page is requested by the server. Use expression language to reference an action method. For example, action="{!doAction}" references the doAction() method in the controller. If an action is not specified, the page loads as usual. If the action method returns null, the page simply refreshes. This method will be called before the page is rendered and allows you to optionally redirect the user to another page. This action should not be used for initialization.
1. Using javascript Onload function:
2. Visualforce page Action:
All Answers
1. Using javascript Onload function:
2. Visualforce page Action:
If you are talking about VF page then please check below post. I hope that will help you
1) http://amitsalesforce.blogspot.in/2015/04/visualforce-page-life-cycle-in.html
Order of executetion in VF page
1) Constructor of controller /extension - >
2) constructor of custom components ->
3) AssignTo any Custom Components ->
4) Action method
5) Getter or Setter
6) Form method -> HTML
So After constructor you are good to go with Action method.
1) https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_compref_page.htm
ApexPages.Action
The action method invoked when this page is requested by the server. Use expression language to reference an action method. For example, action="{!doAction}" references the doAction() method in the controller. If an action is not specified, the page loads as usual. If the action method returns null, the page simply refreshes. This method will be called before the page is rendered and allows you to optionally redirect the user to another page. This action should not be used for initialization.
Let us know if this will help you
Hi @Rupali, @Amit,
Is there a way we could pass a variable with the action method in <apex: page> tag?
Suppose I have a method onLoad:
I want it to be called on page load with a default value passed in the action. How can I accomplish that?
Thanks