function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jaan.vivek746jaan.vivek746 

View State In VF Page

Could any one explain the following queries about "View State".  I have gone through the standard documents for it but I did not get the following queries.

 

I am new to this tech and I am going through it by self practice. So I did not get it clearly.

 

here are my queries-

 

1- What is View State?

 

2- Why we need "View State"?

 

3- What are the benifits of "View State"?

 

4- Based on our design of VF page and Apex class\controller how we can deside this will come in "View State" or not?

 

Thanks for your valuable suggestions.

 

It will help me a lot to know 'View State" in the real-time not based on docs.

 

Thanks,

JaanVivek

 

 

sfdcfoxsfdcfox

1) The view state is a hidden form element submitted each time a page is submitted that contains serialized data about the state of the page. It is analogous to a computer's "RAM", in that it keeps the current operating state of the page.

 

2) The view state allows a stateful environment. It is how a Visualforce page remembers the values of the elements in its controllers and extensions. Without a view state, developers would be required to store data in the database temporarily or pass form values for all elements in the page, even those that are not currently rendered.

 

3) It has basically already been outlined, but the view state enables pages to have more than one state, such as the wizard example in (2). It simplifies development by not requiring developers to have to worry about the underlying mechanisms that make Visualforce possible.

 

4) Anything non-static, non-transient class member will be included in the view state. Save points are always transient, as the database cannot hold the state of the database across transactions (this would cause unnecessary row locks). The view state should be as small as possible to enable fast page loads, but should contain all the necessary data to reconstruct the state without fail. Generally, if a missing value would cause the page to fail to load, it is necessary to be in the view state.

Chamil MadusankaChamil Madusanka

Refer this link

http://wiki.developerforce.com/page/An_Introduction_to_Visualforce_View_State

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.