Contents
What is view state in VF pages?
View state holds the state/size of the visual force page that includes the components, field values, and controller state. This is important in the light that salesforce provides only a standard size of 135kb for any individual page.
What’s the disadvantages of using transient keyword?
A common use case for the transient keyword is a field on a Visualforce page that is needed only for the duration of a page request, but should not be part of the page’s view state and would use too many system resources to be recomputed many times during a request.
Is there any benefit of using a transient keyword in visualforce?
Use the transient keyword to declare instance variables that can’t be saved, and shouldn’t be transmitted as part of the view state for a Visualforce page. Declaring variables as transient reduces view state size.
What is the difference between transient and static?
The main difference between the two ( static versus transient ) is that static variables exist only once per transaction, but transient variables can exist many times. In other words, static variables have a global scope, while transient variables have a local scope.
When to use view state inspector in Visualforce?
View State Inspector will be only visible when developer mode is ON in User profile. There is option to show the View State in User’s Personal information from where View State inspector can be enabled or disabled. Lets take example to demonstrate the behavior of View State. view source print? Consider below Apex class : view source print?
Where do I find the view state inspector?
Developer environments have a view state inspector, which lets you view the contents of the view state. This information can help you in optimizing the view state size. Once enabled, it shows up as a tab in Development Mode, as follows. you can enable that from Edit User-> Select view state checkbox after development mode checkbox.
Is it necessary to control the size of view state?
As Viewstate is transferred over http with every response, it is very necessary to control the size of View State. There are lots of situations where data is not needed after postback or not needed on Visualforce page then in that case we can make variable or object transient.
What is the view state in Salesforce.com?
View state is a state of you VF page, which help salesforce to regenerate VF page when it come back from server