1

I have just came across something that I am unsure about. The link below gives an example of how to use an apex controller with VF. My question is, when does the constructor get called? There is no new keyword so no object is created and therefore the constructor never gets called. Does VF implicitly do this?

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_custom.htm

6

Yes the page constructs the controller and any extensions. See for example Order of Execution for Visualforce Page Get Requests:

A diagram of how a Visualforce page interacts with a controller extention or a custom controller class during a get request

|improve this answer|||||

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.