Visualforce pages that contain a form component also contain an encrypted,hidden form field that encapsulates the view state of the page.The view state is automatically created,and as its name
suggests,it holds the state of the page- state that includes the components,field values and controller state.
1.Minimize number of form on a page.Use apex:actionRegion instead of using 2 or more forms.
2.Refine your SOQL to only retrieve the data needed by the page.
3.All Public and private data members present in standard,custom and controller extensions
are saved.
4.The trasient variables are not passed to view state and therefore not saved in view state.
Note :
The transient keyword prevents the data from being saved into the view state.This should be used for very temporary variables.
Maximum view state size limit is 135KB
Tips on reducing view state size :
===================================
1.Declare a variable as Trasient if possible.
2.Declare variable as static, as it is not saved in view state.
3.if you want to manage your own state, instead of using <apex:form> use HTML<form>
tag instead.
4.Recreate state instead of saving in view state.means if you can use SOQL instead of saving in some object or list,use it.
5.You can also use web service call, Ajax remoting to recreate state instead of saving in object.
suggests,it holds the state of the page- state that includes the components,field values and controller state.
1.Minimize number of form on a page.Use apex:actionRegion instead of using 2 or more forms.
2.Refine your SOQL to only retrieve the data needed by the page.
3.All Public and private data members present in standard,custom and controller extensions
are saved.
4.The trasient variables are not passed to view state and therefore not saved in view state.
Note :
The transient keyword prevents the data from being saved into the view state.This should be used for very temporary variables.
Maximum view state size limit is 135KB
Tips on reducing view state size :
===================================
1.Declare a variable as Trasient if possible.
2.Declare variable as static, as it is not saved in view state.
3.if you want to manage your own state, instead of using <apex:form> use HTML<form>
tag instead.
4.Recreate state instead of saving in view state.means if you can use SOQL instead of saving in some object or list,use it.
5.You can also use web service call, Ajax remoting to recreate state instead of saving in object.
No comments:
Post a Comment