How to configure number of views in session – Perfomance tuning in JSF

JSF will maintain all its views & its state in HTTP session object if state saving method is server which will cause increased usage of memory. To avoid it, we can minimize the number of views stored in session which suits to the application need that can be defined in web.xml given below

<context-param>
 <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
 <param-value>server</param-value>
</context-param>

<context-param>
 <param-name>com.sun.faces.numberOfViewsInSession</param-name>
 <param-value>3</param-value>
</context-param>

<context-param>
 <param-name>com.sun.faces.numberOfLogicalViews</param-name>
 <param-value>10</param-value>
</context-param>

numberOfViewsInSession defines the number of view states (pages) to support back button operation.

numberOfLogicalViews defines the number of logical views (frames) that can present in a page.

Advertisements