Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to reduce javax.faces.ViewState in JSF

What is the best way to reduce the size of the viewstate hidden field in JSF? I have noticed that my view state is approximately 40k this goes down to the client and back to the server on every request and response espically coming to the server this is a significant slowdown for the user.

My Environment JSF 1.2, MyFaces, Tomcat, Tomahawk, RichFaces

like image 604
David Waters Avatar asked Sep 23 '08 15:09

David Waters


1 Answers

Have you tried setting the state saving to server? This should only send an id to the client, and keep the full state on the server. Simply add the following to the file web.xml :

 <context-param>
  <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
  <param-value>server</param-value>
 </context-param>
like image 168
Cristian Vat Avatar answered Oct 12 '22 01:10

Cristian Vat