Order of Visual force page Execution
When we create the visual force page we write Controller/Extensions/Components on server side. Visual force page run by it life cycle means when page is created and page is updated.
Types of visual force requests:
- Get Request-Create New visual force page
As given below points page will execute.
· Constructor-Methods associates with controller/extension are called and instantiating the controller objects.
· If Custom component is in page than set attribute expression by constructor.
· After the assignTo methods are executed, expressions are evaluated, 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.
· If the page contains an <apex:form> component, all of the information necessary to maintain the state of the database between page requests is saved as an encrypted view state. The view state is updated whenever the page is updated.
· 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.
*Note: Once a new get request is made by the user, the view state and controller objects are deleted.
If the user is redirected to a page that uses the same controller and the same or a proper subset of controller extensions, a post back request is made. When a post back request is made, the view state is maintained.
- Post back Request-Update the existing visual force page
· View state is decoded and used as the basis for updating the values on the page.
*Note: the action executes, but no validation is performed on the inputs and no data changes on the page.
· Expressions are evaluated and set methods on the controller and any controller extensions, including set methods in controllers defined for custom components, are executed. If update is not valid due to validation rule or incorrect data type, data is not updated and page redisplay with error message.
· Data updated on action there is no evaluation for <apex:page> component attribute.
· The resulting HTML is sent to the browser.
*Note: Once the user is redirected to another page, the view state and controller objects are deleted.
You can use the setRedirect attribute on a pageReference to control whether a postback or get request is executed. If setRedirect is set to true, a get request is executed. Setting it to false does not ignore the restriction that a postback request will be executed if and only if the target uses the same controller and a proper subset of extensions. If setRedirect is set to false, and the target does not meet those requirements, a get request will be made.
No comments:
Post a Comment