Activity › Forums › Salesforce® Discussions › What is the Action attribute of apex:page for initialization in Salesforce?
Tagged: actionFunction, Actions in Salesforce, Apex Action Poller, Apex:Page, Attributes, Salesforce Apex, Salesforce Apex Class, Salesforce Apex Code
-
What is the Action attribute of apex:page for initialization in Salesforce?
Posted by Saurabh on April 26, 2018 at 4:21 PMwhat is the Action attribute of apex:page for initialization?
Sales replied 7 years, 2 months ago 4 Members · 3 Replies -
3 Replies
-
Hi saurabh,
The reason that we don’t suggest doing initialization there is because we don’t promise that your controller methods will fire in any particular order, other than that your constructor will be called first.If you want to do initialization you should do it in the constructor of your controller, since that will happen when the instance of the class is created. The action attribute is really only useful for redirecting, specifically conditional redirecting.
Thanks.
- [adinserter block='9']
-
Hi Saurabh,
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 isn’t specified, the page loads as usual. If the action method returns null, the page simply refreshes.
This method is called before the page is rendered, and allows you to optionally redirect the user to another page.
Important: This action should not be used for initialization or DML.
Thanks
-
Hi All,
Found new content, it might worth your read
https://www.consilat.com/blogs-why-not-to-use-action-attribute-in-vf-tag/
Log In to reply.